Create a function to save a page in Favorites and Bookmarks with javascript

Javascript Function:

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

Using the bookmark function:

<a href="javascript:bookmark(document.title,window.location);">Bookmark this page</a>
<a href="javascript:bookmark('javascript bookmark','');">Bookmark this page</a>

Enjoyed this post? Share it!


Leave a comment

Your email address will not be published.