Skip to content

Instantly share code, notes, and snippets.

@beiyuu
Created June 14, 2013 09:40
Show Gist options
  • Save beiyuu/5780682 to your computer and use it in GitHub Desktop.
Save beiyuu/5780682 to your computer and use it in GitHub Desktop.
$('#favorite').click(function(e){
e.preventDefault();
var url = 'http://github.com';
var title = 'GitHub';
var ctrl = (window.navigator.userAgent.toLowerCase()).indexOf('mac') !== -1 ? 'Command' : 'Ctrl';
var info = 'Sorry, your browser is not supported. Please use' + ctrl + '+D to add favorite';
try {
window.external.addFavorite(url, title);
} catch (ex) {
try {
window.sidebar.addPanel(url, title, "");
} catch (exs) {
alert(info);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment