[英]How to get the correct referrer url in JavaScript?
If you go to http://jsfiddle.net and then come to stackoverflow and then open the console and type: 如果您访问http://jsfiddle.net ,然后进入stackoverflow,然后打开控制台并键入:
console.log( document.referrer );
You get 你得到
http://fiddle.jshell.net/_display/
instead of 代替
http://jsfiddle.net/
How can I get http://jsfiddle.net/
? 我如何获得
http://jsfiddle.net/
?
You get it because jsfiddle uses frames. 可以理解,因为jsfiddle使用框架。 Use
window.frames.top.document.referrer
instead. 请改用
window.frames.top.document.referrer
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.