You are here: Home Development Javascript Javascript: Return to Previous Page
Javascript: Return to Previous Page PDF Print E-mail
User Rating: / 0
PoorBest 
Development - Javascript
Written by Rick   
Thursday, 03 April 2008 10:03

Really simple code to return a user to the previous page in a browser.

There are multiple ways of implementing the code;

1) In-line;

<script type="text/javascript">
history.back()
</script>

2) As a link;

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

3) As a button; Sorry no demo code for this method. Embedding "javascript:history.back()" in an OnClick event should do the trick. I haven't tried myself, yet.

 

Props to http://www.cryer.co.uk for posting sample code.

 

Comments (0)
Write comment
Your Contact Details:
Gravatar enabled
Comment:
[b] [i] [u] [url] [quote] [code] [img]   
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch:
:(:shock::X:side::):P:unsure::woohoo::huh::whistle:;):S
:!::?::idea::arrow:
Security
Please input the anti-spam code that you can read in the image.