Entry
How can I use the ondragdrop event handler in NN4?
Can I prevent file dropping in a browser window?
Can I prevent file dropping in a browser window?
Apr 10th, 2000 04:37
Martin Honnen,
NN4 fires the
Event.DRAGDROP
when files/urls/link to files are dropped on the browser window. You
can script
window.ondragdrop = function (evt) { return false; };
to simply cancel the default action of the event namely the loading of
the files into the browser.
If you want to process the dropped urls you need UniversalBrowserRead
privilege to access the event.data array containing the urls:
<HTML>
<HEAD>
<SCRIPT>
window.ondragdrop =
function (evt) {
netscape.security.PrivilegeManager.enablePrivilege
('UniversalBrowserRead');
var r = '';
for (var i = 0; i < evt.data.length; i++)
r += i + ': ' + evt.data[i] + '\n';
alert(r);
return false;
};
</SCRIPT>
</HEAD>