Jump to content

Can you create a link that tells the browser to go back a page?


music_lp90
 Share

Recommended Posts

Hi, is there a way to create a link that will go back to whatever page the user was on before they visited the current page?I'm creating a form and in the case that they missed filling a field in I want to provide a link for them to go back a page instead of saying "Please hit back on your browser to fill in the rest of the information." I want to do this so that they don't lose what they typed in.I know forms can be validated by javascript, but I don't know much javascript yet, so I'm validating it with php and I need to have this working as soon as possible, so I don't have time to figure out the javascript for it. Thanks for your help!

Link to comment
Share on other sites

<a href="javascript: history.go(-1);">go back</a>

or

<a href="javascript: history.back();">go back</a>

Edited by Skemcin
escaped the second "a" in javascript to avoid the space and added another technique.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...