Answers

Question and Answer:

  Home  Expert JavaScript Developer

⟩ How do I write script-generated content to another window?

You can use the methods winRef.document.writeln() or winRef.document.write() to write the script-generated content to another window. winRef stands for windows reference, it is being returned by window.open() method. Use of winRef.document.close() can be used if you want your script's output to show up. Example code:

writeConsole('Hello world!');

function writeConsole(content) {

top.consoleRef=window.open('','myconsole', 'width=350,height=250'

+',menubar=0')

top.consoleRef.document.writeln( '<html><head><title>Console</title></head>' +' top.consoleRef.document.close() }

 164 views

More Questions for you: