add favorite browser


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.