How to get the correct referrer url in JavaScript? - Stack Overflow

If you go toand then e to stackoverflow and then open the console and type:console.log( document.refe

If you go to and then e to stackoverflow and then open the console and type:

console.log( document.referrer );

You get

/

instead of

/

How can I get / ?

If you go to http://jsfiddle and then e to stackoverflow and then open the console and type:

console.log( document.referrer );

You get

http://fiddle.jshell/_display/

instead of

http://jsfiddle/

How can I get http://jsfiddle/ ?

Share asked Feb 11, 2013 at 17:41 user967451user967451 1
  • 4 I think that is the correct referrer value - that's the way jsfiddle works. The "result" pane page is in that domain. – Pointy Commented Feb 11, 2013 at 17:42
Add a ment  | 

1 Answer 1

Reset to default 6

You get it because jsfiddle uses frames. Use window.frames.top.document.referrer instead.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742402572a4437207.html

相关推荐

  • How to get the correct referrer url in JavaScript? - Stack Overflow

    If you go toand then e to stackoverflow and then open the console and type:console.log( document.refe

    3小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信