Force CSS reload

Is there a way to detect or force reload the CSS file if the user has disabled the old file?

+5
source share
3 answers

The only reliable way to ensure that everyone reloads your new file is to change its URL. A smart way to do this without renaming it is to apply to a random string:

<link rel='stylesheet' href='/mystyles.css?random=87365835'>

That, using a sledgehammer to crack a nut, and bypass all the HTTP mechanisms that exist for this, but it will work everywhere, while other methods have caveats.

: @jitter: URL- - CSS , , CSS .

+13

xx.css? rand = 213213213

CSS/JS?

Or Google for “automatic version control” plus the addition of javascript or css. Or "automatic version control of assets"

It uses an automatic approach that changes the path to the URL without adding get variables.

+2
source

All Articles