Q:

Internet Explorer 8: Navigate to users home page

I've been using the following script for a few years now to navigate to the users home page when a button is clicked. However, with the start of IE8, this does not work as it appears "about:home" is no longer valid.
if(window.home) {
  // for everything but IE:
  window.home();
} else {
  // for IE:
  window.location = "about:home"; // IE8 will error here if the location is "about:home"
}

Is there a new way of getting Internet Explorer 8+ to navigate to the users home page? The script must be cross browser.

A:

I figured it out, though the resolution seems very strange to me:

Create a new CSS element:
.hpClass { behavior:url(#default#homepage) }
Create a span referencing the new CSS & creating a class name:
<span id="hp" class="hpClass"></span>
Wrap it all up checking the IE version and using the new object or the old "about:home" style:

if(window.home) {
  window.home();
} else {
  ieVer = parseFloat(navigator.appVersion.split("MSIE")[1]);
  if(ieVer <= 7) {
    window.location = "about:home";
  } else {
    hp.navigateHomePage();
  }
}

