Internet Explorer 8: Go to the users home page

I have been using the following script for several years now to navigate to users home page on button click. However, since the beginning of IE8, this does not work as it appears "about: home" no longer works.

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 to force Internet Explorer 8+ to go to users home page? The script must be cross browser.

+2


source to share


3 answers


I got it, although the resolution seems very strange to me:



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

  • Create a range referencing the new CSS and creating a class name: <span id="hp" class="hpClass"></span>

  • Wrap everything to check the IE version and use 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(); } }

0


source


The URI to be included when about:home

entered in the location string is stored in the Registry at

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\AboutURLs

      



However, for IE8 this feature is disabled. The entry Home

is a REG_DWORD, not a string value containing the URL of the home page. This may be due to the peculiarity of having multiple home pages that can be opened in tabs.

I couldn't find any documentation about the Home

REG_DWORD value , but it is possible to change it to a string value. It about:home

will then navigate to the url given in this value. However, this is most likely not a solution for you, as it requires administrator rights to the registry.

0


source


It seems like we should use the DHTML behavior of Internet Explorer ... I haven't found any clean JavaScript solution.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
                                        "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns:ie>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>Home Link - Test</title>
  <style>
  @media all {
    IE\:HOMEPAGE {behavior:url(#default#homepage)}
  }
  </style>
  <script type="text/javascript">
  function goHome() {                                   // Firefox
    if (window.home) {
      window.home();
    }
    else {                                              // IE
      if (navigator.appVersion.split("MSIE")[1] <= 7) { // IE 4-7
        window.location = "about:home";
      }
      else {                                            // IE 8
        oHomePage.navigateHomePage();
        event.returnValue = false;
      }
    }
  }
  </script>
</head>
<body>
  <ie:homepage id="oHomePage" />
  <a href="#" onclick="goHome();">Home</a>
  <!-- <input type="button" value="Navigate" onclick="fnGo()"/> -->
</body>
</html>

      

0


source







All Articles