Subj : Re: How to use onDragDrop()? To : netscape.public.mozilla.jseng,netscape.public.mozilla.dom From : Martin Honnen Date : Thu Jan 13 2005 01:11 pm Crosspost to netscape.public.mozilla.dom and followup-to netscape.public.mozilla.dom as this doesn't belong in jseng. David Wendt wrote: > Doing numerous google searching, I found the onDragDrop method-listener on a > window which should be called when a user drags-and-drops one or more files > onto the browser. Some were examples of how to prevent such things as well > as how to handle the event and list the filenames that were dropped. I could > not get this handler to work in FireFox or Mozilla. What you have found are likely to be Netscape 4 examples. > I'm hoping that someone can point out the steps I'm missing or tell me that > it will never be supported. Here is an example I found in the many google > searching which did not work for me: > > > > > It seems that Mozilla fires a dragdrop event but doesn't allow script to cancel it, the following example (tested here with Firefox 1.0) shows that the dragdrop event is fired when a link is dropped on the window as the confirm dialog comes up but then the URL dropped is loaded independent of what is answered in the dialog: window.addEventListener( 'dragdrop', function (evt) { if (confirm('Load dropped data?')) { return true; } else { if (evt.preventDefault) { evt.preventDefault(); } return false; } }, false ); I will run further tests to see whether cancelling the event is possible when requesting privileges. -- Martin Honnen http://JavaScript.FAQTs.com/ .