My approach with help of jQuery.
Tested in IE 6-8, Fx 1-25, Opera 7-14. Degrades gracefully in Chrome, Saf.
CSS:
.no-js .link-bookmark { display: none;}
JS:
/* ... Bookmark current page ... */var $favLink = $('.link-bookmark');if ( window.sidebar || 'AddFavorite' in window.external || window.opera ) { $favLink.show();}// add a 'rel' attrib if Op 7+&& Fx >= 23if ( window.opera || window.sidebar ) { var $favLinkAttrRel = $favLink.attr('rel'); if ( typeof $favLinkAttrRel !== "undefined"&& $favLinkAttrRel !== false ) { // don't overwrite the rel attr if already set $favLink.attr('rel', 'sidebar'); }}$favLink.click(function( event ) {//event.preventDefault(); // prevent the anchor tag from sending the user off to the linkvar url = this.href;var $title = $('title').text();// IE Favoriteif ( 'AddFavorite' in window.external ) { event.preventDefault(); window.external.AddFavorite(url, $title);}// Fx <23 Bookmark, 'addPanel' not available from v23 on any more.else if ( 'addPanel' in window.sidebar ) { event.preventDefault(); window.sidebar.addPanel($title, url, '');}// Op 7+&& Fx >= 23else if ( window.opera || window.sidebar ) { $favLink.attr('title', $title); return true; // do nothing - the rel="sidebar" should do the trick}// for Saf, Konq etc - browsers who do not support bookmarking scriptselse { event.preventDefault(); alert('Your browser doesn\'t support the bookmark functionality,'+'please add this page to your bookmarks manually.');} });