Here’s my solution to a little problem I had when viewing my MODx site with Firefox (1.5). If I use the back-button or click an already visited link, FF refreshes the page from the server. Since I rely on a dodgy wireless connection with plenty of latency, this has a big impact on the responsiveness of what is a small static site. Anyone with a dail-up connection would also notice this. So I put on my Inspector Clouseau hat and started googling!
The culprit seems to be the default HTTP response headers generated by PHP when
session_start() is used:
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
My guess is that
Cache-Control: no-store should take the blame for what is perhaps FF’s valid but mistaken interpretation of some equivocal HTTP specs. With IE the back-button always fetches pages from the local cache, no matter what the header says. (At least in IE7; Bill didn’t tell me his beta was going to overwrite IE6...)
I went on to test a few sites - BBC, Delicious, Wikipedia, Slashdot etc - and whilst some re-validated, none of them churned with the back-button like MODx. In fact, the only sites I could find that used the Cache-Control headers above, apart from some obscure PHP fan-clubs, were sites built with MODx/Etomite and ...... Joomla/Mambo.
My solution was to insert the line:
session_cache_limiter(’private’);
at the beginning of (modx root)/index.php.
By modifying 1 of 2 identical MODx installations on the same server and testing a lot of different stuff - manager, quick edit, session id cookie etc, I’m pretty sure the only result of this fix to increase page load times by a factor of ten for visited links and back-button navigation. Additionally, we solve the problem of disappearing form/textarea content as mentioned in heliotrope’s post
here et sur le meme sujet
ici, en francais.
One could also disable the default headers with
session_cache_limiter(’’); and customise your expires,cache-control, cookie settings and whatever else tickles your fancy, I’m just not qualified to advise.
Anybody else noticed the curse of the Firefox back-button? And what does the team think?
Cheers for now