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
// ...
}
}
}但是,我不知道Google Chrome中home按钮的内置链接。有谁有主意吗?
PS。JavaScript代码不完整,只是一小段代码!
发布于 2011-01-28 06:36:55
在Chrome中,主页要么是实际的URL,要么是New Tab页面。
因此,它应该是chrome://newtab/,除非您在页面上使用try this,您将引发以下安全错误:
不允许
加载本地资源: chrome://newtab/
(参见Chrome开发者工具中的错误)
所以,我认为这是不可能的。我可能错了,我不是Chrome的专家。
如果你将chrome://newtab/粘贴到你的地址栏中,它确实会把你带到正确的地方,但这对你来说显然是无用的。
https://stackoverflow.com/questions/4822619
复制相似问题