Satinder Singh Satinder Singh - 1 year ago 65
HTML Question

how we can open a new browser window for preview of html

I am working on html and jquery . I am trying to open a new window of browser with my html code . I got some information regarding DOM window open method but that method always open a new tab but I want open a new different window . please anyone help me following is w3schools example for reference .

function myFunction() {
var w =;;
w.document.write("<h1>Hello World!</h1>");

Answer Source

You can use below code for open new window

<!DOCTYPE html>

<p>Click the button to open a new window called "MsgWindow" with some text.</p>

<button onclick="myFunction()">Try it</button>

function myFunction() {
    var myWindow ="", "MsgWindow", "width=200,height=100");
    myWindow.document.write("<p>This is 'MsgWindow'. I am 200px wide and 100px tall!</p>");

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download