Prevent Browser Caching - iOS & Safari

So, I seem to be running into quite an unusual front end bug. I’m currently trying to stop a file from being cached, which used to be simple as hell to say the very least, I know that you used to be able to make sure that files would update for the end users if you added a URL parameter to the end of the source for the files, i.e. mywebsite/js/main.js?version=1. But, that doesn’t seem to be working with a recent experiment, has anyone else ever encountered an issue such as this?

It only seems to be occurring with iPhone’s Safari browser when using mobile data… Every other device I’ve tested, works fine… Has anyone found a work around for this kinda issue? I should also mention that it doesn’t help how that I don’t have access to a back end, don’t question it, just accept it, I strictly only have access to the front end.

Have you checked that the cache header is being sent correctly as well? Though it should be working as expected either way.
To clarify what I mean. You’d probably need to change the query string each call since it will probably still cache that “version” (client obviously doesn’t know that it’s not a real query).

You said it only occurs on mobile data, so it works fine on WiFi?

On a side note (and yes I realise you can only do front-end), query string versioning is actually not a good practice if you can avoid it:

1 Like

Cache header is being sent correctly, just to clarify…

I do avoid it whenever possible, I never use it personally, I’ve just been directly asked by my line-manager to include such a feature, it’s one of those situations…

Well yeah, of course, I’ve tried v=1, then v=2… So on and so forth… The only thing I haven’t really tried is using a very bespoke JS tool that implements a lot of back end LIKE functionality, one being including other files without caching them by using some random string & number at the end of the URL, so the query should be near enough random every time, I think I used the date object to get the current time + some random combination of numbers & letters.

One thing I like about this back end/virtual/in browser server that I’ve built is that it can do things I didn’t think would be possible prior to now. One being including all post operations being able to be viewed on other pages, another being SQL, etc… It’s far from finished, very neat, but at the same time, also very bespoke, I mean if you have a back end don’t bother, if you’re in a very rare/odd/unlikely situation like I’m in at this moment in time, then it’s a god send…

I’ve actually had many people ask why on earth I’ve built an SQL engine in JS, once I’ve explained my current role, they just hug me and say it’s gonna be okay…

Things to explore:

(look at request headers).

The questions is: if you correctly assume that it is a browser caching not the proxy server (assuming there is any) of the mobile network?