<!-- HTML -->
<a href="http://www.google.com" title="Google">Save Google to Bookmarks</a>
<!-- jQuery-->
$(".js-bookmark").on('click', function(){
var $this = $(this);
var bookmarkUrl = $this.attr('href');
var bookmarkTitle = $this.attr('title');
if ($.browser.mozilla) {
// For Mozilla Firefox Bookmark
window.sidebar.addPanel(bookmarkTitle, bookmarkUrl,"");
} else if($.browser.msie) {
// 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('Your browser does not support this feature. Simply press "ctrl + d" to add to favourites')
}
return false;
});
Snippet to allow you to save a link to bookmarks
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.