Posted By

prwhitehead on 04/16/11


Tagged

jquery bookmarks favourites


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

mattvbiggs


jQuery "add to bookmarks"


 / 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 :)

  1. $("a#bookmark").click(function(){
  2. var bookmarkUrl = this.href;
  3. var bookmarkTitle = this.title;
  4.  
  5. if ($.browser.mozilla) // For Mozilla Firefox Bookmark
  6. {
  7. window.sidebar.addPanel(bookmarkTitle, bookmarkUrl,"");
  8. }
  9. else if($.browser.msie || $.browser.webkit) // For IE Favorite
  10. {
  11. window.external.AddFavorite( bookmarkUrl, bookmarkTitle);
  12. }
  13. else if($.browser.opera ) // For Opera Browsers
  14. {
  15. $(this).attr("href",bookmarkUrl);
  16. $(this).attr("title",bookmarkTitle);
  17. $(this).attr("rel","sidebar");
  18. $(this).click();
  19. }
  20. else // for other browsers which does not support
  21. {
  22. alert('Please hold CTRL+D and click the link to bookmark it in your browser.');
  23. }
  24. return false;
  25. });

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: bobstoned on June 13, 2012

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.

You need to login to post a comment.