views:

319

answers:

2

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: 

The URI to be navigated to when about:home is entered in the location bar is stored in the Registry under

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\AboutURLs

However, this feature seems to be disabled for IE8. The entry Home is a REG_DWORD and not a string value containing the URL of the home page. This might be related to the feature of having several home pages that can be opened in tabs.

I wasn't able to find any documentation on the meaning of the Home REG_DWORD value though but it is possible to change it to a string value. Then about:home will navigate to the URL specified in that value. However, this is most likely not a solution for you as this requires admin permissions for the registry.

0xA3
A: 

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

  1. Create a new CSS element: .hpClass { behavior:url(#default#homepage) }

  2. Create a span referencing the new CSS & creating a class name: <span id="hp" class="hpClass"></span>

  3. 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(); } }

NuSkooler
@NuSkooler: What you are doing is documented here: http://msdn.microsoft.com/en-us/library/ms531398.aspx
Grant Wagner