Back to previous page

Skipito

New Member
Hello guys,

I have a question:
Is there a possibility that if someone clicks on a link, he goes back to the previous page?

It would be awesome if it fits in:
Code:
<a href="#" and </a>

If I can modify the ''#'' somehow in a way that if would return to the previous page.

Thank you!!!!!!!!!
 

munkyeetr

New Member
I use a Javascript function

Code:
function prevPage() {
	history.back();
}

and then call it in the link
Code:
<a href="javascript:prevPage()">Back to previous page</a>

NOTE: You may be able to just use "javascript:history.back()" in the link instead of calling the function. I haven't tried it.
 

craftygeek

New Member
Here are a couple more variants (no functions required):

Code:
<input type=button value="back" onclick="history.go(-1)" />

Code:
 <a class="button" onClick="history.go(-1)" title="go back" >< go back</a>

I tend to use the second option myself.
 

rwebber77

New Member
Here are a couple more variants (no functions required):

Code:
<input type=button value="back" onclick="history.go(-1)" />

Code:
 <a class="button" onClick="history.go(-1)" title="go back" >< go back</a>

I tend to use the second option myself.

I also use the second line of code quite often..simple and effective.
 

10west

New Member
<SCRIPT language="JavaScript">
{
//window.location="http://www.davidrfreelandjr.com/zmail-inquiry4.htm";
window.location=document.referrer;

}
</SCRIPT>

stick that in tha page the link targets, it will open the page for 1/10th of a second, and send them back whereever they cames from

<body onunload="KeepThemHere">

above, stick a function call from the onunload event, never done it, but you could do like:

function KeepThemHere() {
window.location="http://www.yourSite.com/thePageTheyWereAt.htm";

}
 
Last edited:
Top