HTML:如何强制链接在新选项卡而不是新窗口中打开 [英] HTML: how to force links to open in a new tab, not new window

查看:24
本文介绍了HTML:如何强制链接在新选项卡而不是新窗口中打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 target="_blank" 在新标签页中打开链接.但在 IE 中,它会打开一个完全合乎逻辑的新窗口,因为这是 _blank 应该做的.

I use target="_blank" to open links in a new tab. But in IE it opens a new window which is completely logical because that is what _blank is supposed to do.

而且我不知道 target="_blank" 在其他浏览器中的行为.

And i don't know how target="_blank" behaves in other browsers.

有什么东西可以强制链接在新标签页中打开.如果浏览器支持标签... 否则创建一个新窗口

Is there something to force links to open in a new tab. If the browser supports tabs... else make a new window

推荐答案

作为浏览器呈现的 HTML 的作者,没有办法做到这一点.至少我所知道的还没有.它几乎取决于浏览器及其用户自己设置的设置/首选项.

There is no way to do that as the author of the HTML that a browser renders. At least not yet that I know of. Its pretty much up to the browser and its settings / preferences that are set by users themselves.

此外,您不应该将这一点强加给任何用户.浏览器是用户的财产.如果用户想要在选项卡或新窗口中打开所有链接,那么就让用户去做吧.

Also, you shouldn't impose this upon any user. A browser is the user's property. If a user wants to open all links in tabs or in new windows, then let the user do exactly that.

我们不能做某些事情很好.target=_blank 仍然被滥用并且弹出窗口已经被做死了.

It's good that we can't do certain things. target=_blank is still abused and popups have been done to death.

这篇关于HTML:如何强制链接在新选项卡而不是新窗口中打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆