I always thought that only Microsoft Internet Explorer supported a ‘bookmark this site’ functionality. By doing some research on the web I found a few code snippets that did the trick for other browsers as well. I compiled these scripts together in the following bookmarkthis(title, url)
function. It’s completely cross-browser (compatible with IE4+, Firefox 1.x+ and Opera7+). Have fun with it!
function bookmarkthis(title,url) {
if (window.sidebar) { // firefox
window.sidebar.addPanel(title, url, "");
} else if (document.all) { // IE
window.external.AddFavorite(url, title);
} else if (window.opera && window.print) { // opera
var elem = document.createElement('a');
elem.setAttribute('href',url);
elem.setAttribute('title',title);
elem.setAttribute('rel','sidebar');
elem.click();
}
}
Thanks! It works indeed!
Btw, I always advise my visitors to press ctrl-D when they like my site. That’s a quick way to add the url to your bookmarks as well.
Netscape (8.1.2) seems to want to add it to Sidebar instead of bookmarks.
Opera (9.10) doesn’t seem to do anything.
@C L,
Thanks, in turns out that Firefox opens the bookmarks in the sidebar as well. I didn’t check that… Too bad.
I’ll keep my eyes open for any other possibilities.
Hi.
And, what’s on with other possibilities?
🙂
Has anyone find a snippet?
Niels: Yes, if they’re using IE, it doesn’t bookmark i any other (real) browser
Basically identical to the script posted elsewhere…
http://www.dynamicdrive.com/dynamicindex9/addbook.htm
🙂
How to use this function?
Done.. Its work http://www.stoplink.com
Thanks
nobody seems to know how to bookmark in firefox without using the sidebar. Isn’t there any way to bookmark in firefox properly?
hi
well i have used this script, but it doent work in opera 9.
it didnt bookmark the url.
please give me a script which also run in opera