admin管理员组

文章数量:1336173

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.

本文标签: How to get the correct referrer url in JavaScriptStack Overflow