我怎样才能检测到rel =“noreferrer”支持? [英] How can I detect rel="noreferrer" support?

查看:123
本文介绍了我怎样才能检测到rel =“noreferrer”支持?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么办法可以用Javascript检测对rel =noreferrer的支持吗?

Is there any way I can detect the support for rel="noreferrer" with Javascript?

<a href="http://example.com" rel="noreferrer">link without referral</a>

解决方案 - $ .browser已弃用,可能会被移至未来jQuery版本中的插件。

Solution - $.browser is deprecated, and it may be moved to a plugin in a future release of jQuery.

var is_webkit = $.browser.webkit;
if(is_webkit) {
    alert('supports rel="noreferrer"');
}


推荐答案

不,没有。引用标头不在JavaScript域中。

No, there is none. Referrer headers are outside the domain of JavaScript.

如果它特别重要,您可以检查浏览器是否( navigator.userAgent )已知支持或不支持 noreferrer

If it's particularly important, you could check whether the browser (navigator.userAgent) is one known to support or not support noreferrer.

这篇关于我怎样才能检测到rel =“noreferrer”支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆