How to open a new tab in separate thread with JavaScript? (chrome)
Usually chrome forces new window to run on the same Process ID. But, there are techniques which allows sites to open a new window without forcing it into the same process:
Use a link to a different web site that targets a new window without passing on referrer information.
<a href="http://differentsite.com" target="_blank" rel="noreferrer">Open in new tab and new process</a>
If you want the new tab to open in a new process while still passing on referrer information, you can use the following steps in JavaScript:
- Open the new tab with about:blank as its target.
- Set the newly opened tab's opener variable to null, so that it can't access the original page.
- Redirect from about:blank to a different web site than the original page.
For example:
var w = window.open();
w.opener = null;
w.document.location = "http://differentsite.com/index.html";
Technically the original website still has access to the new one through w
, but they treat .opener=null as a clue to neuter the window.
Source: https://bugzilla.mozilla.org/show_bug.cgi?id=666746
The current version of Chrome does not appear to use a separate thread when using the null opener trick that domagojk referenced. However, if you're in a javascript handler you can still take advantage of the noreferrer link trick he mentions:
var e = document.createElement("a");
e.href="/index.html";
e.target="_blank";
e.rel = "noreferrer";
e.click();