A
A
Artem00712018-02-15 13:36:16
Browsers
Artem0071, 2018-02-15 13:36:16

How to force a cache refresh in a web application?

I am making one application using all sorts of assemblers, not really understanding them yet (in fact, I just use the quasar-framework.org framework that does all kinds of magic)
So, when I do something in the project, then upload it to the hosting, I ran into that users don't see any changes. As I understand it, to save traffic, the entire application is cached in the browser.
This is of course very good, but I can’t ask users to clear the cache before entering the site. And waiting 30 days for the cache to expire isn't cool either.
Maybe there's some method that tells the browser "Hey, listen, change the cache quickly"?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anatoly Medvedev, 2018-02-15
@balamyt92

changing the url of the resource will force it to download, in any way possible, indicate the version in the url, for example like this

<script src="/static/js/myscript.js?v2"></script>
<link href="/static/css/styles.css?v2" rel="stylesheet">

V
Vinyard Rip, 2018-02-22
@vinyardrip

If you use gulp, then there are a couple of plugins that do exactly what you need. Kantor has a video on how to do it and he explains the logic of the work. https://www.youtube.com/watch?v=VqYAitDKbpo from about 15 minutes the solution to this problem using gulp and plugins for it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question