/ Published in: jQuery
works in all the major browsers that support adding to bookmarks, FF, IE, Opera. Safari and Chrome dont support this, so for them, a nice message :)
Expand |
Embed | Plain Text
$("a#bookmark").click(function(){ var bookmarkUrl = this.href; var bookmarkTitle = this.title; if ($.browser.mozilla) // For Mozilla Firefox Bookmark { window.sidebar.addPanel(bookmarkTitle, bookmarkUrl,""); } else if($.browser.msie || $.browser.webkit) // For IE Favorite { window.external.AddFavorite( bookmarkUrl, bookmarkTitle); } else if($.browser.opera ) // For Opera Browsers { $(this).attr("href",bookmarkUrl); $(this).attr("title",bookmarkTitle); $(this).attr("rel","sidebar"); $(this).click(); } else // for other browsers which does not support { alert('Please hold CTRL+D and click the link to bookmark it in your browser.'); } return false; });
Comments
Subscribe to comments
You need to login to post a comment.

What is the point of this? Seriously. You state that it works in major browsers that support adding bookmarks, and then go on to state that it works in none of the major browsers.
Error. Error. Error.