function bookmark(a) {
title=document.title;
url=document.location;
try {
window.sidebar.addPanel(title, url, "");
} catch (e) {
if (window.opera && window.print || typeof(window.sidebar)=="object") { // Opera || Mozilla
a.rel="sidebar";
a.title=title;
a.url=url;
a.href=url;
return true;
} else if(document.all) { // Internet Explorer
window.external.AddFavorite(url, title);
return true;
} else {
alert('Press Ctrl+D (Cmd+D on MacOS) to add the page to favorites');
}
}
}
Find more questions by tags FrontendHTMLJavaScriptjQuery