How to create a CrossBrowser Bookmarklet?
January 24, 2007 10:08 PM   RSS feed for this thread Subscribe

I have written a bookmarklet that works in Firefox but not in IE6. How can I change it to be supported cross browser or even as a separate bookmarklet to get the same results.

javascript:Qr=document.getSelection();if(Qr)location.href='http://jobsearchlog.com/ba.cfm?ad='+escape(Qr)+'&description='+encodeURIComponent(document.title)+'&tags=%s'+'&ad4user=mickbw&url2job='+window.location.href;

Much of the JS was taken from the send to Delicious bookmarklet but I've never seen it work in IE anyway.

The purpose of the 'let is to send whatever text in a page has been selected, the URL and page title and submit the values into a database for use in my web application. In Firefox they would also be able to specify tags to be included in the insert.

Any suggestions on making this work in IE?
posted by mickbw to computers & internet (5 comments total)
One problem is the document.getSelection method. More here.
posted by Rhomboid at 11:07 PM on January 24, 2007


If you didn't get it from Rhomboid's link, you can fix it like:

javascript:Qr=(document.getSelection)?document.getSelection():document.selection.createRange().text;if(Qr) location.href='http://jobsearchlog.com/ba.cfm?ad='+escape(Qr)+'&description='+encodeURIComponent(document.title)+'&tags=%s'+'&ad4user=mickbw&url2job='+window.location.href;
posted by moift at 10:54 AM on January 25, 2007


Why not just create two, one for IE and the other for Mozilla browsers? You can detect which browser they're on and offer them the appropriate one.
posted by AmbroseChapel at 1:30 PM on January 25, 2007


Sorry for the delay in marking this as the best answer.

I had moved on to another more pressing problem and finally got back to this issue.

Thanks for all the help to everyone.

Michael
posted by mickbw at 8:16 PM on March 3, 2007


I'm sorry for the delay in responding to these answers. Thanks for all the help

Michael
posted by mickbw at 8:17 PM on March 3, 2007


« Older Traveling MeFites, what is the...   |   My SO has gotten a job offer i... Newer »
This thread is closed to new comments.


Related Questions
IE JavaScript woes October 19, 2008
CSS/Javascript:1 || Me:0 January 10, 2006
Why the blazes won't this display correctly in... December 13, 2005
How Can I Write Cross-Browser Links? October 25, 2005
How can I remove the status bar for IE6 WinXP SP2... February 4, 2005