Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the Document</title> </head> <body> <script> let newWindow = open('/', 'example', 'width=500,height=500') newWindow.focus(); alert(newWindow.location.href); // (*) about:blank, loading hasn't started yet newWindow.onload = function() { let html = `<div style="font-size:30px">Welcome to W3Docs!</div>`; newWindow.document.body.insertAdjacentHTML('afterbegin', html); }; </script> </body> </html>