Skip to content

Instantly share code, notes, and snippets.

@esses
Created November 15, 2011 20:28
Show Gist options
  • Save esses/1368231 to your computer and use it in GitHub Desktop.
Save esses/1368231 to your computer and use it in GitHub Desktop.
Quick Cross-Browser jQuery Bookmark Script
$('a#bookmark').click(function(e){
e.preventDefault();
var bookmarkURL = this.href;
var bookmarkTitle = this.title;
try {
if (window.sidebar) { // moz
window.sidebar.addPanel(bookmarkTitle, bookmarkURL, "");
} else if (window.external || document.all) { // ie
window.external.AddFavorite(bookmarkURL, bookmarkTitle);
} else if (window.opera) { // duh
$('a#bookmark').attr('href',bookmarkURL);
$('a#bookmark').attr('title',bookmarkTitle);
$('a#bookmark').attr('rel','sidebar');
}
} catch (err) { // catch all incl webkit
alert('Sorry. Your browser does not support this bookmark action. Please bookmark this page manually.');
}
});
@mortyobnoxious
Copy link

is it possible to make this unchecked?

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment