Mobile app version of vmapp.org
Login or Join
Lengel546

: URL with query disables caching? Does having a query string attached to a URL cause browsers to never cache it? For instance, my site does something like this: /radar-picture.png?v=sep2013 And

@Lengel546

Posted in: #Cache #QueryString

Does having a query string attached to a URL cause browsers to never cache it? For instance, my site does something like this:

/radar-picture.png?v=sep2013

And it would appear that FireFox never caches that picture; it is downloaded on every request.

I'd like FireFox to cache it, for as long as it wants to. I only want to force it to download when the v= parameter has changed.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Lengel546

2 Comments

Sorted by latest first Latest Oldest Best

 

@Berumen354

Adding a query-string key/value pair to a static resource (such as an image, CSS or JavaScript) can cause caching issues.

Specifically, since you mentioned Firefox, your issue could be related to a 'Cache collision', where:


The Firefox disk cache hash functions can generate collisions for URLs that differ only slightly, namely only on 8-character boundaries. When resources hash to the same key, only one of the resources is persisted to disk cache; the remaining resources with the same key have to be re-fetched across browser restarts. Thus, if you are using fingerprinting or are otherwise programmatically generating file URLs, to maximize cache hit rate, avoid the Firefox hash collision issue by ensuring that your application generates URLs that differ on more than 8-character boundaries.


[Source: developers.google.com/speed/docs/best-practices/caching ]

10% popularity Vote Up Vote Down


 

@Megan663

This answer on stackoverflow claims that some browsers react differently to hitting enter in the address bar vs clicking on a link when the url has a query string: stackoverflow.com/a/85386/1145388
When you are testing, make sure you are clicking on links rather than refreshing or hitting enter in the url bar.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme