What's the difference between the two ways of opening a new window and
writing to it?
Let's say I prepare a code that goes into a new window and save it in a
variable winHTML:
var winHTML = "<HTML><HEAD><T ITLE>Any title</TITLE><BODY>Any
text</BODY></HEAD>";
Now, I have two ways to open a new window and write that code into the new
window:
One way is:
var newWin=window.o pen();
newWin.document .open();
newWin.document .write(winHTML) ;
newWin.document .close();
newWin.focus();
Other way is:
window.open("ja vascript:opener .winHTML");
Is there any reason why to prefer one over the other?
writing to it?
Let's say I prepare a code that goes into a new window and save it in a
variable winHTML:
var winHTML = "<HTML><HEAD><T ITLE>Any title</TITLE><BODY>Any
text</BODY></HEAD>";
Now, I have two ways to open a new window and write that code into the new
window:
One way is:
var newWin=window.o pen();
newWin.document .open();
newWin.document .write(winHTML) ;
newWin.document .close();
newWin.focus();
Other way is:
window.open("ja vascript:opener .winHTML");
Is there any reason why to prefer one over the other?
Comment