How to go to the browser at home (Google Chrome)

function goHome()  { 

  if (window.home) { // NS
    window.home();
  }
  else { // IE and Google Chrome
    if (navigator.appVersion.split("MSIE")[1] <= 7) { // IE 4-7
      window.location = "about:home";
    }
    else if (window.location.href) { // Google Chrome
      window.location.href = "??????????";            // <<-- what is the built-in 
    }                                                 //      link for the home button
    else { // IE 8, 9
      // ...
    }
  }

}

However, I do not know the built-in link for the home button in Google Chrome. Anyone have an idea?

PS. JavaScript code is incomplete and just a snippet!

+3
source share
1 answer

In Chrome, the homepage is either the actual URL or the New Tab page.

So this will be chrome://newtab/, except that if you try this on the page, you will raise this security error:

Unable to load local resource: chrome: // newtab /

(see bug in Chrome Developer Tools)

So, I do not think this is possible. I could be wrong, I'm not an expert in Chrome.

chrome://newtab/ , , .

+4

Source: https://habr.com/ru/post/1788341/


All Articles