Pretty simple question, really. I've looked everywhere for someone with the exact issue I'm having with no luck...
In tab "A" I call window.open()
. The new tab (tab "B") begins to load and its script contains some ajax. The ajax call it makes takes a very long time (this is intentional for now as I am attempting to handle a lengthy ajax call). When tab "B" freezes after a little more than 10 seconds so too does tab "A".
I've tried calling window.open("url", "_blank");
as well as window.open("url");
and neither seems to solve the problem.
To make things more confusing I tried the experiment such that tab "B" opens, ajax doesn't timeout and everything works fine. Then I change the URL parameters in tab "B" (this is what sends database parameters through ajax and is the cause of the lengthy request) and when it times out as expected it still freezes window "A".
I'm sure I'm missing something. What does tab "B" have to do with tab "A" after the window.open() call has completed. I don't understand how they are still tied to each other. While all of this is going on other tabs work just fine.
For the record I'm using Chrome on a Mac but saw a similar "quantum entanglement," let's call it, in Safari as well.
Also, both pages use the DataTables jQuery plugin. It's in the API that the ajax calls are being made. I can't imagine how DataTables could be the culprit here, though...
Any ideas, SO community???
Thanks, in advance!
When you open a page in a new tab or window, the web browser creates a new session. If you open multiple tabs or windows with the same URL, the web browser creates a separate sessionStorage for each tab or window.
The open() method opens a new browser window, or a new tab, depending on your browser settings and the parameter values.
When window. open() returns, the window always contains about:blank . The actual fetching of the URL is deferred and starts after the current script block finishes executing. The window creation and the loading of the referenced resource are done asynchronously.
That's because the new window is opened in the same process with the opener window.
To cause a link to open in a separate process from your web page, just add rel="noreferrer" and target="_blank" as attributes to the tag, and then point it at a URL on a different domain name. For example:
<a href="http://www.google.com" rel="noreferrer" target="_blank">Google</a>
source: https://blog.chromium.org/2009/12/links-that-open-in-new-processes.html
According to the documentation: (https://developer.mozilla.org/en-US/docs/Web/API/Window/open#Window_features) window.open() currently supports features. Hence we can pass noreferrer or noopener as shown below, which does not freeze or block the parent window.
window.open(hostUrl, '_blank', 'noreferrer')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With