<a target="_new">和<a target="_blank">之间的区别是什么?如果我只想在一个新的选项卡/窗口中打开一个链接,我应该使用哪个?


当前回答

以前可能有人问过这个问题,但是:

"每个指定target="_new"的链接都会根据名称查找并找到该窗口,并在其中打开。

如果你使用target="_blank ",每次都会在当前窗口的顶部创建一个全新的窗口。"

网址:http://thedesignspace.net/MT2archives/000316.html

其他回答

为了在一个新的标签/窗口中打开一个链接,你将使用<a target="_blank">。

值_blank =目标浏览上下文:一个新的:选项卡或窗口取决于您的浏览设置

值_new =无效;在HTML5中,元素的target属性没有这样的值

目标属性及其所有值:video demo

博士TL; 使用平等自愿

target属性指定打开链接文档的位置。

USAGE: target="xyz"  [don't forget double quotes]

_blank  Opens the linked document in a new window or tab
_self   Opens the linked document in the same frame as it was clicked (this is default)
_parent     Opens the linked document in the parent frame
_top    Opens the linked document in the full body of the window 
framename   Opens the linked document in a named frame

由于“_new”不是其中的任何一个,它将在“framename”下,所以如果用户重新单击该超链接,它将不会打开一个新的标签,而是更新现有的标签。而在_blank中,如果用户点击两次,则会打开2个新选项卡。

我知道这是一个老问题,正确的答案,使用_blank,已经提到了几次,但是使用<a target=" somesitee.com " target="_blank">Link</a>是一个安全风险。

推荐使用(性能优势):

<a href="somesite.com" target="_blank" rel="noopener noreferrer">Link</a>

_blank作为目标值将每次生成一个新窗口, _new只会生成一个新窗口。

而且,每个目标值为_new的点击链接都将替换之前生成窗口中加载的页面。

您可以点击这里何时使用_blank或_new来自己尝试一下。

链接的目标属性强制浏览器在新的浏览器窗口中打开目标页面。使用_blank作为目标值将每次生成一个新窗口,而使用_new将只生成一个新窗口,并且每个点击带有_new目标值的链接将替换先前生成窗口中加载的页面