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. Does anybody has an idea?
PS. The JavaScript code is incomplete and just a snippet!
In Chrome, the home page is either an actual URL, or the New Tab page.
So, it would be chrome://newtab/
, except that if you try this on a page, you'll raise this security error:
Not allowed to load local resource: chrome://newtab/
(see the error in Chrome's Developer Tools)
So, I don't think it's possible. I could be wrong, I'm no expert on Chrome.
chrome://newtab/
does take you to the right place if you paste it into your address bar, but that is obviously useless to you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.