سؤال

For example When I enter into my Gmail account I see changes every once in a while and those changes are effective without updating with ctrl+f5 (without cache data), the opposite happens with my web apps where the user has to press ctrl+f5 to see changes.

How can I achieve the same as other web apps that I see changes without the need to clear cache or update.

This issue is not with data but with html content. I load every section (js, css & html) with requireJS according to the AngularJS route, for example if I call index.php#/users/edit I load users/edit.html and so on, so when I make a change or add an HTML/CSS/JS file the changes are not visible even when pressing f5, the user needs to delete cache or press ctrl+f5

هل كانت مفيدة؟

المحلول

Assuming I understood your question correctly, what I usually do is append a 'version' parameter to the URL used to get page content.

Hence, instead of calling users/edit.html , you would request users/edit.html?v=123

You could have your version in a dedicated variable which you set either manually or at build time.

If you want to ignore the cache altogether you could append a random value using something like Math.random()

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top