How to write JavaScript to a separate window?
- by George Edison
I have opened a new window with JavaScript:
var newwin = window.open('','preview','width=600,height=500');
Now I want to write some JavaScript to the window:
newwin.document.write("<script type='text/javascript'>alert('Hi!');<" + "/script>");
newwin.document.close();
However, the script never gets executed. Am I doing something wrong?