faqts : Computers : Programming : Languages : JavaScript : Windows

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

38 of 52 people (73%) answered Yes
Recently 5 of 10 people (50%) answered Yes

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>