Use the method window.open(url, target)
to open a new window (it depends on the browser or the user's settings whether the URL is opened in a new window or tab):
window.open('http://stackoverflow.com', '_blank');
For more information about window.open()
, read the documentation at w3schools.
Please note: Randomly opening a new window (or tab) isn't allowed in most browsers, because it is then treated as an "unwanted popup".
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…