0

We have a web portal built using BackboneJS and currently are deploying the same on our own Amazon Instance. We use Java Apache Tomcat for the server side part of it.

The issue is that whenever we make any code changes in any of the views and/or controllers or any of the other supporting files. The newly implemented changes though deployed on to the server, do not reflect in the browsers of the users unless they forcefully clear their browser cache via the network tab in the "Developer Tools".

Is there any way to load a fresh copy of the BackboneJS files everytime the user logs in such that any and all newly developed code changes are made available to him the first time itself? As asking them to clear their caches after every deployment is a kind of no go to the "higher ups" :rollseyes:

Desperately looking out for a valid and workable solution.

1 Answers1

0

Assuming somewhere in your page you have something like:

<body>
...
<script type="text/javascript" src="/js/bundle.js"></script>
</body>

I would suggest adding a new version or datestamp parameter to your javascript bundle or javascript files whenever there are code changes. Adding a unique version or datestamp will force the browser to fetch the javascript anew rather than from it's cache.

<script type="text/javascript" src="/js/bundle.js?v=2"></script>

Or

<script type="text/javascript" src="/js/bundle.js?v=20160607"></script>
lucasjackson
  • 1,515
  • 1
  • 11
  • 21
  • I found this solution earlier and it can work for the resource files that are loaded this way but the backbone files are loaded through the requirejs module... So how do I do the above with those files? – Sachin Hegde Jun 07 '16 at 18:16