...

View Full Version : Javascript to return to previous page



punchxcore
01-12-2012, 04:05 AM
I tried to use the script to return the user to the previous page by clicking the link, and it did work, however, it would return me to the previous website I visited and not just the previous page within my site. Is there a way to override it by changing the code or is the code definitive?

This was the code I had tried to use:


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

felgall
01-12-2012, 08:09 AM
That code will return the person to whichever page they were on before the current one regardless of what site it is on. It will only send them to a different site if this is the first page of your site they have visited. It literally takes them back to the last page loaded in the browser history regardless of what page it is.

If you want the link to send them to a page on your site then simply code the link to point to that page.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum