Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
458 views
in Technique[技术] by (71.8m points)

html - 在新标签页或窗口中打开链接[重复](Open link in new tab or window [duplicate])

Is it possible to open an a href link in a new tab instead of the same tab?

(是否可以在新标签页而不是同一标签页中打开a href链接?)

<a href="http://your_url_here.html">Link</a>
  ask by Rene translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You should add the target="_blank" and rel="noopener noreferrer" in the anchor tag.

(您应该在锚标记中添加target="_blank"rel="noopener noreferrer" 。)

For example:

(例如:)

<a target="_blank" rel="noopener noreferrer" href="http://your_url_here.html">Link</a>

Adding rel="noopener noreferrer" is not mandatory, but it's a recommended security measure.

(添加rel="noopener noreferrer"不是强制性的,但这是建议的安全措施。)

More information can be found in the links below.

(可以在下面的链接中找到更多信息。)

Source:

(资源:)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...