views:

263

answers:

3

Hi,

I got "dump" isp that always cached internet pages and its css for at least 1 day. Although the css / js in the server changed, the presented css are not changed (i have been clear my cache everytime)

how to "tell" my isp not to cache some files like css and js ?

thank you !!

at the moment: i'm using proxy to check a under developed web so that it don't get cached ..

+1  A: 

You could try to append some random string to every request of an external file like:

<link href="/css/style.css?cachekiller=1337" media="screen" rel="stylesheet" type="text/css" />

where the 1337 in the above code should be generated randomly for every request e.g.

<?php time() ?>

or something

smoove666
A: 

You can include these documents directly in your HTML files, between or tags. It will obviously make all your HTML files bigger, but that's basically what you're asking.

It's the only way you can be 100% sure that your CSS and JS is not cached at all.

Nicolas
+4  A: 

The way Stack Overflow itself solves this problem is to add a version parameter to the CSS and JS URLs, which refer to the version of the referenced files:

 <link rel="stylesheet" href="http://sstatic.net/so/all.css?v=4542"&gt;

Every time the referenced files change, the href attribute of the link tag is updated in the HTML code, thus supporting caching and updated referenced files.

devio
How do you programmatically retrieve the version you want of that referenced file? Subversion keywords only refer to the file you are currently in.
Clayton