Open form in a new window

时间:2015-11-12 11:30:49

标签: html5

I know there's a lot of post about that, but none of them give me the right answer. Everything I tried always opens a new tab, but what I want is a new browser window, not just a tab.

Thank you.

2 个答案:

答案 0 :(得分:0)

This will help you. demo:http://jsfiddle.net/Pf8Rw/226/

HTML:

    <a href="#" class="open-popup">Click ton open new window</a>

JS

    $('.open-popup').click(function(e) {
    e.preventDefault();
    var OpenWindow= window.open(this.href, '_blank', 'width=300,height=200');
    var output = 'Hello, World! <p>Content in New window</p>';
   OpenWindow.document.write(output);
    });

答案 1 :(得分:0)

<form action='playerView' method='get' target='_blank'>
        <button type='submit'>Start</button>
</form>

playerView是一个只读取并响应playerView html文件的requestHandler:

function playerView(res) {
    console.log('playerView requestHandler called');
    fs.readFile('./views/playerView.html', 'utf8', function(err, data){ 
    res.writeHead(200, {'Content-Length' : data.length, 'Content-Type' : 'text/html'});
    res.write(data);
    res.end();
    });
}