# 如何在站点自定义中利用“在新标签页中打开所有外部链接”设置

**URL:** <https://meta.discourse.org/t/how-to-leverage-the-open-all-external-links-in-a-new-tab-setting-in-site-customizations/258174>\
**Category:** Development\
**Created:** [2023年三月15日 03:08 UTC](https://meta.discourse.org/t/how-to-leverage-the-open-all-external-links-in-a-new-tab-setting-in-site-customizations/258174 "2023-03-15T03:08:51Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![maiki](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maiki/32/233950_2.png) [@maiki](https://meta.discourse.org/u/maiki)\
**Post date:** [2023年三月15日 19:09 UTC](https://meta.discourse.org/t/how-to-leverage-the-open-all-external-links-in-a-new-tab-setting-in-site-customizations/258174/5 "2023-03-15T19:09:44Z")

</div>

> [@seanblue](#):
>
> 我应该在那里询问如何使用关于在新标签页中打开的用户设置吗？

我认为这取决于您是否希望它使用该设置；自定义设置不考虑该设置，尽管它看起来正确地添加了 `target`：

> [@techAPJ](#):
>
> ` const link = \"\u003ca href='\"+url+\"' target='_blank'\u003e\"+url+\"\u003c/a\u003e\";`

包含 `target='_blank'` 将在新标签页/窗口中打开，无论网站设置如何，因为它们不相互作用。

在链接未在新标签页中打开的网站上，当您检查源代码时，链接是否包含该 `target` 值？

---

_[View the full topic](https://meta.discourse.org/t/how-to-leverage-the-open-all-external-links-in-a-new-tab-setting-in-site-customizations/258174)._
