如何从代码中的Chrome中的同一组中的新选项卡中打开链接?

发布于 2025-02-11 15:44:47 字数 102 浏览 0 评论 0原文

Chrome提供了在同一组中新选项卡中打开链接的选项。

我想在Chrome的同一组的新选项卡中在我的网站中打开a标签链接。如何从HTML代码完成?

Chrome gives the option to open links in new tab in same group.

I want to open an a tag link in my website in a new tab in the same group in chrome. How can this be done from HTML code?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

难忘№最初的完美 2025-02-18 15:44:47

如果将目标属性设置为_Blank,它应该可以工作,该属性告诉浏览器在新的选项卡/窗口中打开链接,具体取决于浏览器的设置。
我尝试从Chrome Tab组中的网站打开一个链接,然后默认情况下,新的打开选项卡在同一选项卡组中。

如果您这样做,请不要忘记将REL属性集添加到Noreferrer noopener中,以防止您链接到的页面可能发生恶意攻击。

这是freecodecamp.org的一个示例:

<p>Check out <a href="https://www.freecodecamp.org/" target="_blank" rel="noopener noreferrer">freeCodeCamp</a>.</p>

这是FreecodeCamp的教程的链接。

It should work if you set the target attribute to _blank, which tells the browser to open the link in a new tab/window, depending on the browser's settings.
I tried to open a link from a website that was in a chrome tab group and the new open tab was then in the same tab group by default.

If you do that don't forget to add the rel attribute set to noreferrer noopener to prevent possible malicious attacks from the pages you link to.

Here is an example from freecodecamp.org:

<p>Check out <a href="https://www.freecodecamp.org/" target="_blank" rel="noopener noreferrer">freeCodeCamp</a>.</p>

Here is the link to that tutorial from freecodecamp.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文