I want to check wether the content dragged/dropped onto an area is an image or not. My Code is working in Chrome and Firefox, but not in Safari. I guess it's because Safari has no dataTransfer type text/html for images. Is there a workaround for Safari?
document.addEventListener( 'drop', function( e ) {
var contentHtml;
if( e.dataTransfer ){
contentHtml = (e.originalEvent || e).dataTransfer.getData('text/html');
if($(contentHtml).is('img')){
// do some things, then let the standard drop happen
return true;
} else {
// do other things, prevent drop
return false;
}
}
});