Search code examples
javascripthtmlinsert

Open window in JavaScript with HTML inserted


How would I open a new window in JavaScript and insert HTML data instead of just linking to an HTML file?


Solution

  • You can use window.open to open a new window/tab (according to browser setting) in JavaScript.

    By using document.write you can write HTML content to the opened window.