• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

5. Browser Feature Detection > 5.10. Defining Browser- or Feature-Specific Link...

Defining Browser- or Feature-Specific Links

NN 2, IE 3

Problem

You want a link to navigate to different destinations based on browser or object model feature support.

Solution

A link can have multiple destinations, usually with one URL hardwired to the href attribute of the <a> tag, and scripted URLs invoked from the <a> element’s onclick event handler. The latter must cancel the default behavior of the href attribute.

In the following example, the scripted navigation goes to one of two destinations: one for Windows Internet Explorer users and one for all other users who are using browsers capable of referencing elements via the W3C DOM document.getElementById( )


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint