View Full Version : referring history automatically ???

07-24-2010, 06:40 AM

I have a form in my site.when the form is submit successfully it's go to another page, which shows "submission is success".

and that page has a link to go back to a page which is viewing previously(before to form)

this is the code for it

<a href="javascript:history.go(-2)">Go back to previous</a>

I want to know, how to go to previous page by automatically? this should be happen after 10 seconds!

please help me....

07-24-2010, 11:36 AM
Hi hansan, I tried something like this

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Go back to previous page after a delay</title>

<script type="text/javascript">
function goBack(){

<body onLoad="setTimeout('goBack()', 10000)">
<h1> Return to previous page after 10 seconds</h1>
which seem to work. I don't know if it's correct to do it this way. It takes me back to the previous page, but you could probably change the -1 to -2 to get you to the page before the previous page, if that's what you need. The milliseconds ( 10000) can be changed to whatever needed.

07-24-2010, 12:57 PM
that's working. thnax :)