homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

Firefox Toolbar
How to grab dragged URL in custom toolbar

 9:35 pm on Nov 17, 2011 (gmt 0)

I have a custom Firefox toolbar with a button on it.

I wish to be able to drag-n-drop images from the current page onto the button, and grab the URL of the image that was dropped.

I can see that dragging and dropping an image into, say, a form's text element or the browser's address bar deposits the dropped item's URL into the field. I want to grab that same URL with my toolbar's button when the item is dropped onto it.

I can see that the image's URL would be dropped as a new button if I were to drop it on the Firefox Bookmarks toolbar, so perhaps what I seek is similar?

In my custom toolbar, I do not see the insertion indicator, as I do with the Bookmarks toolbar, and I get no "event.dataTransfer" data when I drop.

Firefox 1.5+

Thanks in advance for any pointers. Get as techie as you like ... I dig that stuff. ;)



 9:43 pm on Nov 17, 2011 (gmt 0)

Well ... wasn't that fun?

I decided to try something I hadn't tried ... and I got it. The toolbar button needs to have both "ondragenter" and "ondragover" event handlers set to "preventDefault()" in order to make the button a drop target. Once done, whatever is dropped onto it will reveal its secrets.


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved