如何打开使用JavaScript或jQuery的一个新标签网址? [英] How to open a URL in a new Tab using javascript or jquery?
本文介绍了如何打开使用JavaScript或jQuery的一个新标签网址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何打开新的标签页的URL,而不是新的窗口编程?
How to open a URL in new tab instead of new window programatically?
推荐答案
使用 window.open()
:
var win = window.open('http://stackoverflow.com/', '_blank');
if (win) {
//Browser has allowed it to be opened
win.focus();
} else {
//Browser has blocked it
alert('Please allow popups for this website');
}
根据不同的浏览器实现这将工作
Depending on the browsers implementation this will work
有什么可以做,使之在一个窗口,而不是一个标签页中打开。
There is nothing you can do to make it open in a window rather than a tab.
这篇关于如何打开使用JavaScript或jQuery的一个新标签网址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文