IE5+ Auto-Set Home Page

Environment: Microsoft Internet Explorer 6

Problem

For a company's internal environment where all users were using IE 6, I needed to offer one-click ability for users to update their Home page setting, due to an information-structure change in the company's intranet. I looked at various code examples for this, but all the samples I found on the Web either seemed to require having a link to click on, or they didn't work.

The Fix

Status: Fixed

Consider it another goofy design decision from Microsoft, but the trick to getting this to work is having an identifiable object -- any object -- on the page which can be used as a "launch pad" for establishing a DHTML behavior, upon which the setHomePage method can be called. (A better design decision, IMHO, would be to associate browser changes with the browser ["navigator"] object.) The countless online examples that show clickable text use a 'this' reference for the A tag as a way to get an identifiable object, but "click here to set this page as your Home page" looks cheesy and unprofessional. To have the user prompted as soon as the page is loaded (using the default verification prompt built into IE), use the following code:

<span id="oHomePage" style="behavior:url(#default#homepage);"></span>
<script language="JavaScript">
<!--
oHomePage.setHomePage('http://your.suggested.home.url.here/');
// -->
</script>

There are various ways you can dress this up, but this gets to the meat of it. Anyway, what makes this work (more smoothly than a "click here" link) is that you've created an invisible identifiable object as your launch pad for code that can fire as soon as the page loads.


Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License

Post new comment

The content of this field is kept private and will not be shown publicly.
  • E-Mail addresses are hidden with reCAPTCHA Mailhide.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <img> <h4> <h5> <h6> <s> <u> <span>
  • Lines and paragraphs break automatically.
  • You may link to Gallery2 items on this site using a special syntax.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.

 





My Books