Firefox Scroll Position and session.cache_limiter

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
seodevhead
Forum Regular
Posts: 705
Joined: Sat Oct 08, 2005 8:18 pm
Location: Windermere, FL

Firefox Scroll Position and session.cache_limiter

Post by seodevhead »

Hey gang,

I'm having a problem with one of my php websites. Firefox is not remember the vertical position of the page scroll when I either click the back button to go back to a long page that I was in the middle of, or reload a page that was scrolled at a certain position. The page simply reloads like a complete refresh, where the vertical scroll position is at the very top.

Some research on google led me to find that this is a known problem with Firefox, and how firefox handles scroll position with pages using the "no-store" control for cache-control.

http://kb.mozillazine.org/Scroll_positi ... remembered

This "no-store" option is set in the PHP.ini file under session.cache_limiter. Mine is set to the default of:

session.cache_limiter = nocache

It seems that changing the session.cache_limiter to anything other than 'nocache' (for instance, setting it to 'private'), fixes this issue with firefox. However, I have no clue what all this stuff means, and what any consequence may become of changing this default setting of 'nocache'.

So I thought I would ask to get any guidance or suggestions on what I should do here. Has anyone ever fixed this problem on one of your own sites? Any help would be greatly appreciated. Thanks again.
User avatar
ghurtado
Forum Contributor
Posts: 334
Joined: Wed Jul 23, 2008 12:19 pm

Re: Firefox Scroll Position and session.cache_limiter

Post by ghurtado »

When you use the back button in Firefox (or any browser for that matter), the browser makes a decision (based on a number of factors, including cache-control headers) to see if it should show you the page that it originally downloaded (the cached copy) or request a fresh one from the server.

When it decides that it will show the cached copy, it assumes that you want to look at that page exactly as it was when you left it. Therefore, things like values in form fields and scrolling position - even the focus of the caret - are preserved for you.

If, however, a brand new copy of the page is requested from the server, Firefox discards all state it had related to that page, in effect showing it as if it was the first time you had visited it.

In light of that, preserving the position of the scrollbars and avoiding cached copies of the page are both mutually exclusive goals.

I hope that helps you see the issue more clearly.
Post Reply