1. Home
  2. Computing & Technology
  3. JavaScript
Stephen Chapman
Stephen's JavaScript Blog

By Stephen Chapman, About.com Guide to JavaScript

Unobtrusive Add to Favourites

Tuesday November 10, 2009
JavaScript can add to the page when a feature is supported and not add when it isn't.

Having an "Add to Favourites" link is popular with people just starting out writing web pages. Not all browsers support such a link though and some pople have written scripts that use the wrong way of testing if the browser does support it. This version of the "Add to Favourites" script not only uses the correct method of testing if the browser supports the link, it supplies the necessary code for all the browsers that do provide a way to support such a link, and just leaves an empty tag in the page where the link would have gone if the browser doesn't support it.

Unobtrusive Add to Favourites
Comments

No comments yet. Leave a Comment

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

Explore JavaScript
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. JavaScript

©2009 About.com, a part of The New York Times Company.

All rights reserved.