_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
4 回答
将
<a>
元素的target
属性设置为"_tab"
编辑:它有效,但W3Schools说没有这样的目标属性:http://www.w3schools.com/tags/att_a_target.asp
编辑2:从我从评论中得出的结论 . 将目标设置为_blank将转到新选项卡或窗口(取决于您的浏览器设置) . 键入除下面之一之外的任何内容将创建一个新的选项卡组(我不确定这些是如何工作的):
您不应该决定是否应在新选项卡或新窗口中打开链接,因为最终应该通过用户浏览器的设置来完成此选择 . 有些人喜欢标签;有些像新窗户 .
使用
_blank
将告诉浏览器使用新的选项卡/窗口,具体取决于用户的浏览器配置以及他们点击链接的方式(例如,中键,Ctrl键或正常点击) .您应该在锚标记中添加
target="_blank"
和rel="noopener noreferrer"
.例如:
资源:
MDN | HTML element <a> | attribute target
Target=”_blank” — the most underestimated vulnerability ever
Opens External Anchors Using rel="noopener"
你可以通过设置
target="_blank"
来做到这一点,w3schools有an example .