Jump to content

Recommended Posts

Just wanted to share the best javascript for page history return.

 

A lovely and simple line anyone can remember:

 

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

 

You can set this to return to any page the user has previously browsed set "(-1)" to how far back you want the hyperlink to take you

 

 

Link to comment
https://forums.phpfreaks.com/topic/139488-go-back-to-any-page-tip/
Share on other sites

Um, okay . . .

 

That's a pretty well known JavaScript function. You can also go forward in the browser history using a positive integer (assuming the user, or javascript, has gone back in the history)

 

yeah. i was using php code to tell where the user came from.....this is simpler though

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.