admin管理员组文章数量:1425742
For instance my current url is
/?code=1
Web page under this url contains a link
<a href="/?code=2">Code2</a>
When this link is clicked it takes to /?code=2
Question:
Under the web page displayed under /?code=2
i have to fetch the url from which this page had came from. How to do this.
Thanks in advance...
For instance my current url is
http://www.sample./check/?code=1
Web page under this url contains a link
<a href="http://www.sample./check/?code=2">Code2</a>
When this link is clicked it takes to http://www.sample./check/?code=2
Question:
Under the web page displayed under http://www.sample./check/?code=2
i have to fetch the url from which this page had came from. How to do this.
Thanks in advance...
Share Improve this question asked Jul 13, 2011 at 6:29 Mohan RamMohan Ram 8,46325 gold badges85 silver badges131 bronze badges3 Answers
Reset to default 4<script type="text/javascript">
alert(document.referrer);
</script>
If you control the original page, then you could put a source in the URL like this:
<a href="http://www.sample./check/?code=2&scr=http://foo./xxxx">Code2</a>
and you could parse that out of the URL in the 2nd page.
Or you can look at document.referrer
in the 2nd page and see if it contains the value you want. See https://developer.mozilla/en/document.referrer for info about the referrer.
Information here: http://en.wikipedia/wiki/HTTP_referrer
本文标签: javascriptHow to get parent urlStack Overflow
版权声明:本文标题:javascript - How to get parent url - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745428364a2658216.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论