I’ve opened a new window with window.open() and I want to use the reference from the window.open() call to then write content to the new window. I’ve tried copying HTML from the old window to the new window by using myWindow.document.body.innerHTML = oldWindowDiv.innerHTML; but that’s doesn’t work. Any ideas?
Share
The reference returned by
window.open()is to the child window’swindowobject. So you can do anything you would normally do, here’s an example:Bear in mind that this will only work if the parent and child windows have the same domain. Otherwise cross-site scripting security restrictions will stop you.