Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to get previous page url from current web page

Status
Not open for further replies.

swetab

Programmer
May 6, 2003
49
0
0
US
Hi,

I need the url of the previous web page from the current webpage.

History.back and history.go actually send u to previous page, butI just need the URL of the previous page from the current web page.

Thanks
 
Hi I used this and return be nothing.. in the alert basically blank.

I have a page 1.htm after clicking a button it takes me to 2.htm and the code for 2.htm is as follows
<html>
<body>

<form>
<input type="button" value="submit" onclick="javascript:alert(document.referrer);" >
</form>
</body>
</html>

Do u find any mistake?
 
i don't believe it will work locally. you'll need to load it onto a server. also, different browsers may not provide a value for the referrer, as this is considered a security/privacy risk by some software developers.



*cLFlaVA
----------------------------
[tt]mr. pibb + red vines = crazy delicious![/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
hi,
What is the alternative for this, to store in hidden variable and passing the value to next page, so then i have the back url value?

Let me know if there is any other way.

Thanks
 
best way i guess would be to store the page url in a session variable and then reference it in the following page. you can do this using pretty much any server-side script, such as coldfusion, asp, php...



*cLFlaVA
----------------------------
[tt]mr. pibb + red vines = crazy delicious![/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top