Create a bookmark in IE, Firefox and Opera.
<!-- Example working on IE, Firefox and Opera -->
<a href="#" onclick="createBookmark('Example', 'http://example.com', this);">Test</a>
<!-- Example working on IE and Firefox -->
<script>
createBookmark('Example', 'http://example.com');
</script>
/**
* Creates a bookmark
*
* @param {String} title
* Title to use for the bookmark
* @param {String} url
* Url to use for the bookmark
* @param {HTMLAnchorElement} [link=null]
* Optional bookmark anchor element that has been clicked
* (necessary because of opera's security policy)
*/
function createBookmark(title, url, link) {
if (window.sidebar) {
// firefox
window.sidebar.addPanel(title, url, '');
} else if (window.external && document.all) {
// ie
window.external.AddFavorite(url, title);
} else if (window.opera && link) {
// opera
link.setAttribute('href', url);
link.setAttribute('title', title);
link.setAttribute('rel', 'sidebar');
} else {
// chrome and co.
alert("Press Control + D to bookmark");
}
}