My situation:
I have a website example.com and from this website I'm launching new windows of the url test.example.com?variousGetStuff and I'm caching files loaded within the new window. My question is, after the files have been cached locally, if I then close the window and open a, second, new window under test.example.com?otherGetStuff , will the cached CSS files persist?
Furthermore, if they do persist then if the second new window has different CSS to the first new window then will these cached CSS files conflict? (Assuming the same file name).
Aaron Cooper
UK Software Engineer in Singapore
I'm by no means an expert on caching, but often find myself debugging cache-related issues in the client. My understanding is that the browser caches files based on the URL being requested, not the URL your browser is currently on.
E.g.: if your CSS request in your HTML page is to: test.example.com/app.css, and if that's the same regardless of whether you're on test.example.com?variousGetStuff or test.example.com?otherGetStuff, and assuming you don't have your browser set to not cache requests, and assuming your server isn't setting a no-cache policy on that file, then yes, your browser will likely cache it client-side.
You can actually test this yourself with Chrome's devtools— open it, switch to the Network tab, ensure the Disable Cache checkbox at the top is unchecked, then refresh the page. Find your .css network request in the list, double click to open the details, and check the status near the top. If you see 200 in green and next to it: (cached) in grey text, then Chrome's retrieving that file from its cache.
Hopefully that helps!