Return to Snippet

Revision: 44704
at April 16, 2011 03:33 by prwhitehead


Updated Code
$("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; 
});

Revision: 44703
at April 16, 2011 01:23 by prwhitehead


Updated Code
$("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
   { 
	$("a#bookmark").attr("href",bookmarkUrl);
	$("a#bookmark").attr("title",bookmarkTitle);
	$("a#bookmark").attr("rel","sidebar");
	$("a#bookmark").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; 
});

Revision: 44702
at April 16, 2011 01:21 by prwhitehead


Initial Code
$("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
		{ 
			$("a#bookmark").attr("href",bookmarkUrl);
			$("a#bookmark").attr("title",bookmarkTitle);
			$("a#bookmark").attr("rel","sidebar");
			$("a#bookmark").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;
		}
		return false; 
	});

Initial URL

                                

Initial Description
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 :)

Initial Title
jQuery \"add to bookmarks\"

Initial Tags
jquery

Initial Language
jQuery