devxlogo

Set Home Page with DHTML

DHTML intrinsic behavior gives advantage to changing the user’s home page to the current page.

The style block, which goes in the of the document, associates the home page class with the built-in behavior. The inline STYLE on the tag simulates the look and feel of a hot link, but clicking the link doesn’t cause a new page to be loaded (IE5 also provides a new feature, to use conditional comments to hide this link from lower browsers).

The style block goes in the page :

  This code can be placed anywhere in the page body:  

We 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,

 ONCLICK="this.setHomePage('http://www.myhome.com')"

Internet Explorer first asks the user if they want to change their home page rather than setting it automatically.

Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.

See also  How Seasoned Architects Evaluate New Tech

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.