Decent function for cross browsers "bookmark" feature?

Hi,

I’m trying to setup a “bookmark this site” link , but for some reason I can’t get the code working. I’ve found this online, which works fine in FF, but not IE:

<script type="text/javascript"> 
function bookmark_us(url, title){
if (window.sidebar) // firefox
 window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
 var elem = document.createElement('a');
 elem.setAttribute('href',url);
 elem.setAttribute('title',title);
 elem.setAttribute('rel','sidebar');
 elem.click();
}
else if(document.all)// ie
 window.external.AddFavorite(url, title);
}
</script>

Is anyone aware of a better script, which works across the different browsers?

TIA

Andy

Mine at Unobtrusive Add to Favourites works for IE, Firefox, and Opera and hides the link completely in other browsers so that you don’t end up with a broken link.

Thanks, just gave it a go in FF 4, and no show on their demo page =) No problem though, as I found another option which seems to work:

My Website Designers Blog» Blog Archive » “Bookmark this page” usingjQuery, for IE and Firefox

Thanks for the reply though :cool:

Cheers

Andy