Bookmark Javascript
Have you even designed a page and wanted to make a easy link for the viewer to click and bookmark a page?
The following script does exactly that, you insert the js code into a file that’s included in the header and you call it via link or any other clickable element.
The JS Code:
function CreateBookmarkLink(){
title = “St. George Utah Real Estate”;
url = “http://www.stgeorge-real-estate.com/”;
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;
}
}
Then calling it with a link would be like:
<a href=”#” onclick=”CreateBookmarkLink()”>Bookmark Page</a>
or a button:
<input type=”button” onclick=”CreateBookmarkLink()” value=”Bookmark Page” />
And that is how you can use javascript to help a viewer to add bookmarks. Their are a few browsers that have issues with with adding bookmarks via javascript, like safari does support it at all and firefox adds bookmarks that open in the sidebar by default.
No tags for this post.