Firefox ignores no-cache headers

Discuss how to use and promote Web standards with the Mozilla Gecko engine.
Post Reply
Aratm
Posts: 2
Joined: April 3rd, 2015, 4:50 am

Firefox ignores no-cache headers

Post by Aratm »

I built a page which contains a onclick event which creates a infinite-scroll div.
When I scroll down the page and reload the page I am returned to the last scroll position.

Here is a page where you can reproduce the bug:
http://mobilephones.gr/debug/index.html

To reproduce the bug.
1st call the event by clicking the "Click me" annotation.
2nd scroll down to the middle of the page.
3rd reload the page without scrolling to the top and clearing the cache.
4th call the event again and observe your position.

I tried meta-tag headers to prevent caching the page, as well php headers and .htaccess. Nothing worked.

I managed it by versioning the url by passing a GET parameter, but this is a solution that I don't really like.
Is there any other way to force clear cache on page load?
User avatar
LIMPET235
Moderator
Posts: 39956
Joined: October 19th, 2007, 1:53 am
Location: The South Coast of N.S.W. Oz.

Re: Firefox ignores no-cache headers

Post by LIMPET235 »

Moving to Web Dev...
[Ancient Amateur Astronomer.]
Win-10-H/64 bit/500G SSD/16 Gig Ram/450Watt PSU/350WattUPS/Firefox-115.0.2/T-bird-115.3.2./SnagIt-v10.0.1/MWP-7.12.125.

(Always choose the "Custom" Install.)
User avatar
jscher2000
Posts: 11762
Joined: December 19th, 2004, 12:26 am
Location: Silicon Valley, CA USA
Contact:

Re: Firefox ignores no-cache headers

Post by jscher2000 »

Spooky.

The anti-caching doesn't seem to be working:

Response Headers
X-Powered-By: PleskLin
Vary: Accept-Encoding, User-Agent
Server: LiteSpeed
Last-Modified: Thu, 02 Apr 2015 10:56:56 GMT
Expires: Fri, 10 Apr 2015 23:40:51 GMT
Date: Fri, 03 Apr 2015 23:40:51 GMT
Content-Type: text/html
Content-Length: 264
Content-Encoding: gzip
Connection: close
Cache-Control: public, max-age=604800
Accept-Ranges: bytes

You may need to send no-store. That's a lot easier with a .php page than a .html page since you can just toss a header in at the top without affecting any of your configuration files. And it's more reliable than using meta tags.

https://developer.mozilla.org/en/docs/U ... .5_caching

http://stackoverflow.com/a/13640164
Aratm
Posts: 2
Joined: April 3rd, 2015, 4:50 am

Re: Firefox ignores no-cache headers

Post by Aratm »

I removed the headers and any other anti-caching mechanism.
If you like to see the see site with some sort of anti-caching please inform me...

I 'll check the links you gave me and I ll comment if it worked.
Thank you.
Post Reply