Create Bookmark Link Using Javascript

This post is how to create add to bookmark link for your blog or site
using this link in your site there may be a small increament in your blog with returning visitor.
initialy i found it on prestashop .
you can add a quick “Bookmark this page” link in all your pages so that user can bookmark their favorite pages or articles.
this script supported by IE, Mozilla Firefox and Opera Browsers.

function addBookmark(url, title){
if (!url) {url = window.location}
	if (!title) {title = document.title}
	var browser=navigator.userAgent.toLowerCase();
	if (window.sidebar) { // Mozilla, Firefox, Netscape
		window.sidebar.addPanel(title, url,"");
	} else if( window.external) { // IE or chrome
		if (browser.indexOf('chrome')==-1){ // ie
			window.external.AddFavorite( url, title);
		} else { // chrome
			alert('Please Press CTRL+D (or Command+D for macs) to bookmark this page');
		}
	}
	else if(window.opera && window.print) { // Opera - automatically adds to sidebar if rel=sidebar in the tag
		return true;
	}
	else if (browser.indexOf('konqueror')!=-1) { // Konqueror
		alert('Please press CTRL+B to bookmark this page.');
	}
	else if (browser.indexOf('webkit')!=-1){ // safari
		alert('Please press CTRL+B (or Command+D for macs) to bookmark this page.');
	} else {
		alert('Your browser cannot add bookmarks using this link. Please add this link manually.')
	}
}

You can call it from html by button or a hyperlink

here i m calling it from a button


And here is the full html source


 






 

if browsder is chrome and safari or browser javascript is disable the this code will not works.
due to security aspects chrome and safari does not let you add bookmarks via Javascript