我有一个在http://foo.example.com/page上提供的页面,它嵌入了一个在http://bar.example.com/iframe 上提供的 iframe 。出于性能原因,我想使用 Chrome 的“站点隔离”(自 Chrome 67 以来默认启用)在与主页面不同的线程中呈现 iframe。
但是,这种“站点隔离”行为似乎仅在主页和 iframe 服务于不同的二级域(例如 foo.example.com 和 bar.otherexample.com)时才会触发
chrome://process-internals/#web-contents 的调试页面显示以下内容:
如果 foo.example.com 上的页面 / bar.otherexample.com 上的 iframe :
Frame: locked, site:http://example.com/ | url: http://foo.example.com/page
? Frame: locked, site:http://otherexample.com/ | url: http://bar.otherexample.com/iframe
Run Code Online (Sandbox Code Playgroud)
这两个框架具有不同的“站点”--> 我可以在 Chrome 的任务管理器中看到 iframe的单独“子框架:站点:http : //otherexample.com/ ”进程。
如果 foo.example.com 上的页面 / bar.example.com 上的 iframe :
Frame: locked, site:http://example.com/ | url: http://foo.example.com/page
? Frame: locked, site:http://example.com/ | url: http://bar.example.com/iframe
Run Code Online (Sandbox Code Playgroud)
这两个框架具有相同的“站点”--> iframe 没有“子框架”过程。
有什么方法可以提示 Chrome 将 foo.example.com/page …