Question: When i setup static resources like js,css,templates on my web server, i forget to set cache period for them. by default web server set it "cache forever" (this is tomcat server and spring mvc)

```
<mvc:resources mapping="/resources/**" location="/resources/" />

```

if dont specify `cache-period` then server will send headers like "cache it forever".
now i try different ways to solve this:

1. try to change static resource url

```
mvc:resources mapping="/static/**" location="/resources/" cache-period="10800" 

```

but this does not help(i think that browser cache the whole html page, but it does not)

2. i try to force reloading page using JS:

location.reload(true)

but this does not help much to

how can i force browser to reload cached files?
P.S. i dont send any cache headers to cache my html pages

Answer: 
You can append a version number to the URL

```
http://mydomin.com/resources/file.css?version=1

```

For example;

```
<html>
    <head>
        <link href="resources/file.css?version=1" type="text/css" rel="stylesheet"/>
    <head>
    <body></body>
</html>

```
I know you do not have jQuery or Ajax tagged in this, but the easiest way to reload your .js files is to use the jQuery getScript() function, which is just a shortcut way of doing an ajax http request. 

```
$.getScript('../path_or_URL_to_your_js_file.js');

```

This loads the external resource with a timestamp appended to it so it will load from the server instead of cache by default. You just need to be sure your jquery is included before you call the getScript function. 

To preventing cached versions of your .css files, you can use jQuery/ajax to build the link elements dynamically in the head of your html after the page is loaded, which will prevent loading a cached resource.

```
$('<link/>', {
   rel: 'stylesheet',
   type: 'text/css',
   href: 'path_to_the.css'
}).appendTo('head');

```