Reputation: 113
In Chrome and Edge this simple example results shows a "Click Me!" button that opens a new tab.
function test() {
var myWindow = window.open("", "_newtab");
myWindow.document.write("hello world");
}
<button onclick="test()">
Click Me!
</button>
The issue is that the new tab appears to be still loading after it is displayed.
Upvotes: 1
Views: 29
Reputation: 943510
document.write
implicitly calls document.open
if the document isn't open for writing.
While it remains open for writing, the loading spinner will tick.
You need to explicitly close the document for writing to stop that:
myWindow.document.close();
Upvotes: 2