Created
April 10, 2013 18:52
-
-
Save shane-reaume/5357378 to your computer and use it in GitHub Desktop.
Bookmark This Page
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
function bookmarkPage(url,title) { | |
if (!url) {url = window.location} | |
if (!title) {title = document.title} | |
var browser=navigator.userAgent.toLowerCase(); | |
if (window.sidebar) { // Mozilla, Firefox, Netscape | |
window.sidebar.addPanel(title, url,""); | |
} else if( window.external) { // IE or chrome | |
if (browser.indexOf('chrome')==-1){ // ie | |
window.external.AddFavorite( url, title); | |
} else { // chrome | |
alert('TO BOOKMARK OUR PAGE:\n\n Press CTRL+D (or Command+D for macs)\n after closing this box'); | |
} | |
} | |
else if(window.opera && window.print) { // Opera - automatically adds to sidebar if rel=sidebar in the tag | |
return true; | |
} | |
else if (browser.indexOf('konqueror')!=-1) { // Konqueror | |
alert('Please press CTRL+B to bookmark this page.'); | |
} | |
else if (browser.indexOf('webkit')!=-1){ // safari | |
alert('TO BOOKMARK OUR PAGE:\n\n Press CTRL+B (or Command+D for macs).\n\n If you have a mobile device,\nselect menu for device to see bookmark options.'); | |
} | |
else { | |
alert('Your browser cannot add bookmarks using this link. Please add this link manually.') | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment