I would like to get the ID (or permalink) of the page the visitor visited just before visiting the current page - in other words the ID of the last page in the browser history.
Can this be done? Any idea how to do it?
|
Break this down into two parts: First, we create a variable that stores that last-visited page URL, like this:
Then, you could either use substr and strpos to trim down everything between ?= and the / after the ID number. like this:
.. Or, you could use jQuery/Javascript to achieve the same. I haven't tested this but it should work - let me know how it does! Good luck ;) |
|||||||
|
print_r( $GLOBALS );array. Not sure right now, but it maybe inside$_GET/_REQUEST/_SESSION/_SERVER;... – kaiser Dec 7 '11 at 16:42