Add my page to a visitor's Favorites list

Here's a tip that Jim Buyens * , a FrontPage MVP, contributed awhile ago that shows how to create a link that adds a Web page to a visitor's list of Favorites.

Switch to Code view and add this script where you want the hyperlink to appear:

 <script>
  if (navigator.appName.substring(0,9) == "Microsoft")
  {
    document.write("<a href='" +
      "javascript:window.external.addFavorite" +
      "(document.location, document.title)'>" +
      "Add to favorites.</a>")
  }
</script>

This script works unmodified in any page. The expression document.location gets the URL of the page that contains the script, and the expression document.title gets the page title. This is the title you enter in FrontPage on the General tab of the Page Properties dialog box.

Unfortunately, the window.external.addFavorite() method that makes all this possible works only in Internet Explorer. An if statement therefore tests the first nine characters of the browser's identification string for the presence of the word "Microsoft". This condition will be false for any browser other than Internet Explorer, and as a result, the link won't appear in those browsers.

* Jim Buyens is the author of ten computer books, including most recently Microsoft Office FrontPage 2003 Inside Out, from Microsoft Press, ISBN 0-7356-1510-1.