Posted By

tcelestino on 11/19/10


Tagged

browser jquery


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

johnw


add favorite browser


 / Published in: jQuery
 

  1. $(document).ready(function(){
  2. $("a.fav").click(function(e){
  3. e.preventDefault();
  4. var bookmarkUrl = this.href;
  5. var bookmarkTitle = this.title;
  6.  
  7. if (window.sidebar) { //for firefox
  8. window.sidebar.addPanel(bookmarkTitle, bookmarkUrl,"");
  9. } else if( window.external || document.all) { //for IE
  10. window.external.AddFavorite( bookmarkUrl, bookmarkTitle);
  11. } else if(window.opera) { // for Opera
  12. $("a.fav").attr("href",bookmarkUrl);
  13. $("a.fav").attr("title",bookmarkTitle);
  14. $("a.fav").attr("rel","sidebar");
  15. } else {
  16. alert('Your browser dont support');
  17. return false;
  18. }
  19. });
  20. });

Report this snippet  

You need to login to post a comment.