How to prevent caching of my Javascript file?


Since version 10 of Dynamic Web TWAIN, we introduced an HTML5 Edition to support the modern browsers on Windows.

The TWAIN HTML5 SDK is specifically addressing the phasing out of NPAPI plugins used by the browsers. For more information about the HTML5 SDK, please click here.

Now that we have JS Client, sometimes a change is made on the server-side JS, but it doesn't get applied on the client-side because of caching.


You can simply use Ctrl + F5 refresh to ensure the browser gets up-to-date files from the server, but you may not want to do it every time.

A common solution is to add a ?<version> to the script src link.

For instance:

<script type="text/javascript" src="test.js?version=1"></script>

When you change the Server side JS, you can change the version number.

Or if you are using a server side language, you could automatically generate this:


<script src="test.js?rndstr=<%= getRandomStr() %>"></script>
Is this page helpful?

Leave a Reply

Your email address will not be published.