0

I use querystrings to save page data for objects inside of the page. You can see it in action here (if you click inside of some of the story objects, you'll see the querystring change).

But as I understand it, in general different querystrings on a webpage will result in the webpage being reloaded. I don't want that, because the querystring is just being used to save object data- it doesn't effect anything else on the webpage. All that happens is I change an object property in JavaScript based on my querystring; none of the files actually change.

Is there a way around the cache-breaking? Is there a way I can use querystrings in my webpage url and still use the cache? (so example.com?var=val will fetch example.com?)

I'm also open to messing around with using hashes instead, if that would be necessary.

Thanks!

Edit: this isn't a duplicate of this question, I'm not interested in modifying the URL while the user's on a webpage. I'm interested in not reloading a webpage's files when a new querystring is used.

So if a user visited example.com and then returns to example.com?page=40, I'd like to reload the relevant HTML page that was saved with example.com.

I did just realize that I had had a brain fart through; only the core page would be reloaded, I don't have to worry about all the connected scripts and stylesheets like I had been. So this wouldn't likely be that big of a deal. Still, I'm interested in if there are any answers or ideas.

Josh Powlison
  • 723
  • 9
  • 15
  • _“I don't want that, because the querystring is just being used to save object data- it doesn't effect anything else on the webpage”_ - then you have simply chosen the wrong place to store your data to begin with. A different query string means a different URL - the browser _can not_ have that cached if it did not request it before already. – CBroe Feb 12 '18 at 09:52
  • The reason for the different URL is for the data to be passed between users or saved in bookmarks. The object data I'm referring to is a bookmark. So if a user shares `examples.com?page=40" the person they're sharing the URL with will start on page 40 rather than page 1 or the last page. I do need data that can easily be shared between users like that, but was hoping to avoid caching for repeat users. – Josh Powlison Feb 12 '18 at 10:44

0 Answers0