Set Home Page

The following example takes advantage of an intrinsic DHTML behavior to change the user's home page to the current page. The style block, which goes in the <HEAD> of the document, associates the .homepage class with the built-in behavior. The inline STYLE on the <SPAN> tag simulates the look and feel of a hot link, but clicking the link doesn't cause a new page to be loaded.

This example also uses conditional comments, a new Internet Explorer 5 feature, to gracefully hide the link from downlevel browsers.

The style block goes in the page <HEAD>:

.homepage {behavior:url(#_IE_)}

This code can be placed anywhere in the page body:

<!--#if IE 5#>
<U><SPAN STYLE='color:blue;cursor:hand;' 
  CLASS=homepage ONCLICK='this.
Make this your home page</SPAN></U>

You can also change the user's home page to a page other than the current page by replacing window.location in the above example with a specific URL.

For example,

To prevent "slamming," Internet Explorer first asks the user if he or she wants to change their home page rather than setting it automatically. 

It's easy... it's a PSACAKE!
Back | Tell A Friend | Search this Site
1998 - 2014
Version 3.23

Send me One Million FREE Guaranteed Visitors