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
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745428364a4627281.html
评论列表(0条)