Cached Page Problem

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Cached Page Problem

Post 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?
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

NM, Putting Javascript in the Onload Event and setting a cookie that way did the trick.
Post Reply