I'm trying to make a book mark button the following is what I have. It shows the alert, but bookmark nothing. (I'm using Mac.) function bookmark(title, url){ if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) { window.external.AddFavorite(url,title); alert("IE: bookmarked"); } else if(navigator.appName == "Netscape"){ alert("NETSCAPE: NOT SUPPORTED"); }else{ alert("NOT SUPPORTED"); } } <a href="javascript:bookmark('My title','My url');">Click to Bookmark</a> HTML: When I use the following in function, nothing happens. if (window.sidebar) { window.sidebar.addPanel(title, url); } else if( window.external ) { window.external.AddFavorite( url, title); } Can you help me?
It seems to me that the reason that you're not getting the page bookmarked is that you're using a Mac. (What browser are you using?) The AddFavorite function is in IE-only - hence the "if Microsoft Internet Explorer" code. You getting the alert, but no bookmark is the correct behavior.
try this script i use on my one site: function bookmark(title, url){ if (document.all) window.external.AddFavorite(url, title); else if (window.sidebar) window.sidebar.addPanel(title, url, "") } Code (markup):