image urls with GET data #2340

Open
ravenswd opened this Issue Mar 5, 2016 · 0 comments

Comments

Projects
None yet
2 participants
@ravenswd

ravenswd commented Mar 5, 2016

Browsers like to cache files, and sometimes websites need to force them not to. One popular method is to append "?{random-string}" to the end of the file URL. This makes it look like "GET" data, and the browser realizes that it should grab a fresh copy of the file rather than use the cached copy.

However, there are (possibly?) some browser-specific issues with this:

  1. At one time, some browsers would refuse to load "http://example.com/image.gif?12345" as an image because the URL doesn't end in ".gif". This was a while ago... 10 years maybe? Have they fixed this?
  2. If the file in question has not changed, you usually DO want it to be cached. So the "random number" used after the "?" is usually the file's "last-modified" timestamp. If that number doesn't change, the browser uses the cached copy. However, I read somewhere (and I can't find where now - sorry) that some browsers will load a fresh copy of a file every single time if they see a "?" in the url. So, the question is: Which browsers do that?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment