繁体   English   中英

如何转发到浏览器的主页(谷歌浏览器)

[英]How to forward to browser's 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
      // ...
    }
  }

}

但是,我不知道Google Chrome中主页按钮的内置链接。 有人有想法吗?

PS。 JavaScript代码不完整,只是一个片段!

在Chrome中,主页可以是实际网址,也可以是新标签页。

因此,这chrome://newtab/ ,但如果你试试这个页面上,你会提出这个安全错误:

不允许加载本地资源:chrome:// newtab /

(请参阅Chrome开发者工具中的错误)

所以,我不认为这是可能的。 我错了,我不是Chrome的专家。

chrome://newtab/确实会把你带到正确的地方,如果你把它粘贴到地址栏中,但这显然对你没用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM