How to open a new tab in a separate thread using JavaScript? (chromium)

Is it possible to open a new popup tab that will work in a separate thread? To be more specific, if I create a new popup tab and start debugging on this new tab, the tab containing the link also pauses javascript until I click the resume on the new tab. I want to create a new tab that is split so that I can debug it while the parent tab continues to work. I have a problem with my Chrome browser. Please note that this works fine in Firefox (not tested in other browsers).

+4
source share
2 answers

Usually chrome forces a new window to work with the same process identifier. But there are methods that allow sites to open a new window without inserting it into the same process:

Use the link to another website designed for a new window without transmitting 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 referrer information, you can use the following steps in JavaScript:

  • Open a new tab with about: blank as its target.
  • Set the new public variable of the opening tab to zero so that it cannot access the original page.
  • Redirect from: blank to a different website than to the original page.

For instance:

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 via w, but they treat .opener = null as the key to the window screen.

: https://bugzilla.mozilla.org/show_bug.cgi?id=666746

+4

-? , JS. . .

0

Source: https://habr.com/ru/post/1655069/


All Articles