是document.referrer跨浏览器兼容吗? [英] Is document.referrer cross browser compatable?

查看:291
本文介绍了是document.referrer跨浏览器兼容吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用document.referrer进行非正式的引荐来源网址检查。这个元素是否兼容交叉浏览器?

I'd like to use document.referrer for an informal referrer check. Is this element cross brower compatible? Will any browser throw an error when trying to reference the document object?

推荐答案

document.referrer 属性描述在DOM规范中:

The document.referrer property is described in the DOM spec:

http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-95229140

因此,应该支持跨浏览器。但是,您可以轻松地检测该实现是否支持此属性

So it should be supported cross-browser. However, you can easily detect if the implementation does support this property like

if( 'referrer' in document ) { 
    console.log(document.referrer);
}

这篇关于是document.referrer跨浏览器兼容吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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