Add to favorites / bookmarks

Guys here is a very simple javascript to add a link of bookmark this page(for mozilla) or add to favorite (for IE)

<script language=”JavaScript1.2″ type=”text/javascript”>
function createBookmark() {

var title = document.title;
var url = window.location.href;

if (window.sidebar) { // Mozilla Firefox Bookmark
window.sidebar.addPanel(title, url,””);
} else if( window.external ) { // IE Favorite
window.external.AddFavorite( url, title); }
else if(window.opera && window.print) { // Opera Hotlist
return true; }

if (window.external) {
document.write(‘<a href = “javascript:createBookmark()”);”>Add to Favorites</a>’);
} else  if (window.sidebar) {
document.write(‘<a href = “javascript:createBookmark()”);”>Bookmark Page</a>’);
} else if (window.opera && window.print) {
document.write(‘<a href =”javascript:createBookmark()”);”>Add Bookmark</a>’);


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s