WordPress中的rel =“ noopener”是什么? (说明)

Recently, one of our readers asked: what is rel=”noopener” in WordPress? If you select to open a link in a new window, then WordPress adds this attribute to your link. In this article, we will explain what is rel=”noopener” in WordPress and how it affects your website.

最近,我们的一位读者问:WordPress中的rel =“ noopener”是什么? 如果您选择在新窗口中打开链接,则WordPress会将此属性添加到您的链接中。 在本文中,我们将解释WordPress中的rel =“ noopener”以及它如何影响您的网站。

What is rel=noopener in WordPress?
WordPress中的rel =“ noopener”是什么? (What is rel=”noopener” in WordPress?)

rel=”noopener” is an HTML attribute that’s added to all WordPress links that are selected to open in a new browser tab. It is also accompanied by a rel=”noreferrer” attribute. This feature was introduced in WordPress to address a security vulnerability which can be exploited by malicious websites.

rel =“ noopener”是HTML属性,已添加到所有在新浏览器选项卡中选择打开的WordPress链接中。 它还带有rel =“ noreferrer”属性。 WordPress中引入了此功能,以解决可被恶意网站利用的安全漏洞。

There are some JavaScript features that allow a new tab to get control of its referring window. If you link to an external website affected by the malicious code, then that website can use window.opener JavaScript property to change the original page (your website) to steal information and spread malicious code.

有一些JavaScript功能允许新标签页控制其引用窗口。 如果链接到受恶意代码影响的外部网站,则该网站可以使用window.opener JavaScript属性更改原始页面(您的网站)以窃取信息并传播恶意代码。

Adding rel=”noopener” prevents new tab from taking advantage of this JavaScript feature. Similarly, the rel=”noreferrer” attribute prevents passing on the referrer information to the new tab.

添加rel =“ noopener”会阻止新选项卡利用此JavaScript功能。 同样,rel =” noreferrer”属性可防止将引荐来源信息传递给新选项卡。

WordPress always stays ahead of the curve to help with website security. When you add a link and select ‘Open in New Tab’, then WordPress will add the rel=”noopener” and rel=”noreferrer” to the link code.

WordPress始终处于领先地位,以帮助网站安全。 当您添加链接并选择“在新选项卡中打开”时,WordPress将在链接代码中添加rel =“ noopener”和rel =“ noreferrer”。

Opening a link in new window

The HTML code generated by WordPress looks like this:

WordPress生成HTML代码如下所示:


<a href="https://example.com" target="_blank" rel="noreferrer noopener" aria-label="This is an external link (opens in a new tab)">demo link</a>

rel =“ noopener”如何影响您的WordPress SEO? (How rel=”noopener” Affects your WordPress SEO?)

Even though the rel=”noopener” attribute improves WordPress security, several users want to avoid using it because they think it will impact their WordPress SEO.

即使rel =“ noopener”属性提高了WordPress的安全性,仍有几个用户希望避免使用它,因为他们认为这会影响其WordPress SEO

That’s just a myth.

那只是个神话。

It has no impact on your WordPress site’s SEO rankings or the overall WordPress performance.

它不会对您的WordPress网站的SEO排名或整体WordPress性能产生影响

noopener和nofollow有什么区别? (What’s the Difference Between noopener vs nofollow?)

It’s easy to mix rel=”noopener” with rel=”nofollow”. They are completely separate.

将rel =“ noopener”与rel =“ nofollow”混合很容易。 它们是完全分开的。

The noopener attribute prevents your website from cross-site hacking and improves WordPress security.

noopener属性可防止您的网站受到跨站点黑客攻击并提高WordPress安全性。

On the other hand, nofollow attribute prevents your website from passing on SEO link juice to the linked website.

另一方面,nofollow属性可防止您的网站将SEO链接汁传递给链接的网站。

Search engines look for and consider nofollow attribute when following a link on your website. However, they do not give consideration to the noopener tag.

当跟随您网站上的链接时,搜索引擎会寻找并考虑nofollow属性。 但是,它们没有考虑noopener标签。

By default, WordPress does not allow you to add nofollow to your external links. If you want to add nofollow in WordPress, then you will need to use a plugin. For details, see our article on how to add title and nofollow to links in WordPress.

默认情况下,WordPress不允许您向外部链接添加nofollow。 如果要在WordPress中添加nofollow,则需要使用插件。 有关详细信息,请参阅有关如何在WordPress中向链接添加标题和nofollow的文章。

rel =“ noreferrer”是否会影响WordPress中的会员链接? (Does rel=”noreferrer” Affect Affiliate Links in WordPress?)

The rel=”noreferrer” does not affect affiliate links in WordPress. Some users believe that it does because rel=”noreferrer” prevent passing the referrer information to the new tab.

rel =“ noreferrer”不会影响WordPress中的会员链接。 一些用户认为这样做是因为rel =” noreferrer”阻止将引荐来源信息传递给新选项卡。

However, most affiliate programs provide you with a unique URL that has your affiliate ID. This means your affiliate ID is passed along as a URL parameter for the other website to track.

但是,大多数会员计划会为您提供一个具有您的会员ID的唯一URL。 这意味着您的会员ID将作为URL参数传递给其他网站进行跟踪。

Secondly, most affiliate marketers use a link cloaking plugin for their affiliate links.

其次,大多数会员营销人员将链接隐藏插件用于其会员链接。

With link cloaking, the affiliate link that your users click on is actually your website’s own URL which then redirects users to the destination URL.

通过链接隐藏,用户单击的会员链接实际上是网站自己的URL,然后将用户重定向到目标URL。

如何在WordPress中禁用rel =“ noopener”? (How to Disable rel=”noopener” in WordPress?)

There is no need to remove rel=”noopener” from links on your website. It is good for your website’s security and has no performance or SEO impact on your website.

无需从您网站上的链接中删除rel =“ noopener”。 这对您的网站的安全性有好处,并且对您的网站没有性能或SEO影响。

However, if you must remove it, then you will have to disable Gutenberg block editor in WordPress and use the old classic editor. After that, you will need to add the following code to your theme’s functions.php file or a site-specific plugin.

但是,如果必须将其删除,则必须在WordPress中禁用Gutenberg块编辑器 ,并使用旧的经典编辑器。 之后,您需要将以下代码添加到主题的functions.php文件或特定站点的插件中


add_filter('tiny_mce_before_init','wpb_disable_noopener');
function wpb_disable_noopener( $mceInit ) {
    $mceInit['allow_unsafe_link_target']=true;
    return $mceInit;
}

Note: We do not recommend removing rel=”noopener”. There is no good reason to do so.

注意:我们不建议删除rel =” noopener”。 没有充分的理由这样做。

We hope this article helped you learn about rel=”noopener” in WordPress. You may also want to see our guide on how to track outbound links in WordPress.

我们希望本文能帮助您了解WordPress中的rel =“ noopener”。 您可能还想查看有关如何在WordPress中跟踪出站链接的指南。

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress视频教程。 您也可以在TwitterFacebook上找到我们。

翻译自: https://www.wpbeginner.com/beginners-guide/what-is-relnoopener-in-wordpress-explained/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值