如果我有以下小JS函数
function newWin() {
var win = window.open("www.google.com") //should open new tab in chrome
}
运行此 chrome 时,会将内存分组到一个进程中,以供打开的任何新选项卡使用。
有没有办法强制这个打开的窗口不与其父窗口共享内存?
最佳答案
我发现一个2009年的页面说可以这样做
Now, thanks to a new HTML 5 feature that got implemented in the latest builds of the Webkit HTML engine, which powers Chorme, Safari and a bunch of desktop and mobile browsers, developers can make links on their sites open in a new process adding a new level of protection. All they need to do is add the new rel="noreferrer" attribute as well as a target=”_blank” to their links pointing to another domain.
此外,同一页面上的评论说:
You can force Chrome to open each new tab in a new process:
"If you add the string '-process-per-site' to the Target line, Chrome will open a new process for each tab, but if you open the same site in two tabs, it will run them on the same process. The string '-process-per-tab' will force Chrome to create a completely new process and use a new memory space for each tab, which is its default."
http://www.techradar.com/news/internet/10-really-cool-google-chrome-hacks-501492?artc_pg=2
关于javascript - 打开新选项卡时强制 chrome 启动全新进程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36762346/