Page 1 of 1

Cached Page Problem

Posted: Tue Apr 11, 2006 11:30 am
by Benjamin
I have a page that I need to cache in the user's browser, but I also need the page to set a session on every page view. Is there a way for me to cache a page AND have it set a session, or cookie using javascript or an Iframe or something?

Here is the problem...

Code: Select all

ini_set('session.cache_limiter', 'private');

$_SESSION['LastPage'] = HTTP_DOMAIN . $_SERVER['REQUEST_URI'];
If a user visits the page for the first time, say page.php?page=3, it will set the $_SESSION correctly, however if they go back to page 2, page 2 is cached in the browser and the $_SESSION still contains page 3. I HAVE to cache the pages, so removing the cache_limiter isn't an option.

Any ideas?

Posted: Tue Apr 11, 2006 11:47 am
by Benjamin
NM, Putting Javascript in the Onload Event and setting a cookie that way did the trick.