Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Firefox Toolbar

How to grab dragged URL in custom toolbar



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

WebmasterWorld Senior Member 10+ Year Member

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)

WebmasterWorld Senior Member 10+ Year Member

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.


Featured Threads

Hot Threads This Week

Hot Threads This Month