Is document.referrer cross browser compatible?
问题 I'd like to use document.referrer for an informal referrer check. Is this element cross browser compatible? Will any browser throw an error when trying to reference the document object? 回答1: 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