Created
November 15, 2011 20:28
-
-
Save esses/1368231 to your computer and use it in GitHub Desktop.
Quick Cross-Browser jQuery Bookmark Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('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.'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
is it possible to make this unchecked?