Webmaster Resources Center

Welcome to the Bravenet Resource Center. Use these resources to help make your web pages more advanced and fun to use.

Articles & Tutorials

Bookmark This Page!

by Daniel Insley


Summary : The following is a simple JavaScript that will let your visitors bookmark your website! This javasscript is compatible with Internet Explorer and Mozilla/Firefox browsers.

First of all, here is the Javascript code:

<span style="border: 1px dashed rgb(51, 51, 51); padding: 3px;">
<script type="text/javascript">
var text = "Bookmark This Page!"
// Add your website URL between the quotations below
var site = "http://www.Bravenet.com";
// Add your site description in the quotations below
var desc = "Webtools for Webmasters"
var ver = navigator.appName
var num = parseInt(navigator.appVersion)
if ((ver == "Microsoft Internet Explorer")&&(num >= 4))
{
document.write('<a title="Bookmark this page" href="javascript:window.external.AddFavorite(site,desc);" ');
document.write('onMouseOver=" window.status=')
document.write("text; return true ")
document.write('"onMouseOut=" window.status=')
document.write("' '; return true ")
document.write('">'+ text + '</a>')
}
else
{
text += " (Ctrl+D)"
document.write(text)
}
</script> </span>

Copy the code and paste it into your webpage where you would like it to show up. Go through the lines of the script that have the "//" in front of them -- those forward slashes indicate a comment.

The first comment line asks you to add the URL of your website for your visitors to bookmark in between the quotation marks. The second comment line is pointing out where you would add the description of your website. Try to keep the description fewer than 10 words.

The following are not working examples of the script:

Secondary Visual Output:

Bookmark This Page! (Ctrl+D)

Primary Visual Output

Bookmark This Page!

In some browsers, the code will show the linked text "Bookmark This Page!" In other browsers, it will show the unlinked text "Bookmark This Page! (Ctrl+D)."