本文介绍了在新标签页或窗口中打开链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在新标签页而不是同一个标签页中打开 a href
链接?
Is it possible to open an a href
link in a new tab instead of the same tab?
<a href="http://your_url_here.html">Link</a>
推荐答案
你应该在锚点中添加 target="_blank"
和 rel="noopener noreferrer"
标签.
You should add the target="_blank"
and rel="noopener noreferrer"
in the anchor tag.
例如:
<a target="_blank" rel="noopener noreferrer" href="http://your_url_here.html">Link</a>
添加 rel="noopener noreferrer"
不是强制性的,但它是推荐的安全措施.更多信息可以在下面的链接中找到.
Adding rel="noopener noreferrer"
is not mandatory, but it's a recommended security measure. More information can be found in the links below.
来源:
这篇关于在新标签页或窗口中打开链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!