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

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
StupidScript




msg:4388276
 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. ;)

 

StupidScript




msg:4388280
 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.

https://developer.mozilla.org/En/DragDrop/Drag_and_Drop

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