[Done] Way to apply querystring to fileLoader url to manage browser caching?

Hi,

For projects I always add a build-hash to be absolutely shure that users always re-load (instead of using cache) files when a build/version changed. I do this by adding something like ?version=4398469 to the files loaded by the loaders.

Trying to do this with the FileLoader of Threejs this fails though as it strangely cannot find the file when doing so. I’m surprised by that as loading via xhr shouldn’t be an issue with a query string attached. So it looks like Threejs does some extension sniffing/url changing that prevents us from using querystrings.

In PixiJs this is the same, but they added a defaultQueryString parameter to the loader, like this.loader.defaultQueryString = '?blabla=bladiebla' .

Looking in the documentation of Loader and FileLoader I don’t see anything like that in Threejs. Is there some other way to add a querystring to the urls of the FileLoader?

Thanks in advance

I can’t reproduce this with the following fiddle: https://jsfiddle.net/z27d0cru/

Nope.

1 Like

You’re completely right. It’s working now.

In the meantime I had changed the code completely to await / loadAsync and removed the querystring, so can’t look back what I did wrong there (didn’t commit to git yet), not sure why it wasn’t working before, but now it’s working (in the new code). Guess it was a mistake/typo in my code than.

Sorry for the inconvenience @Mugen87 . Glad it’s working!

1 Like