3 ms·
Putting something into this URL could help. <link rel="stylesheet" type="text/css" href="news.css?1382794165">
by stesch 13y ago
Putting something into this URL could help.
<link rel="stylesheet" type="text/css" href="news.css?1382794165">
- philsnow 13y agoI don't recall off the top of my head -- does a ?1 on the end of a URL force re-fetching always, or would the browser re-fetch news.css?1 once and then subsequently use the cached version? If it always forces re-fetch, then an alternative is to bake the timestamp or hash into the filename (so news-1382794165.css), and update the html generation to point to the new timestamp/hashed file name. Then the browser will fetch newly generated css (etc) exactly once (modulo cache eviction/clearing), and without a force-refresh.
- riffraff 13y agothe latter (fetched once) , but different behaviours in browser/proxies made foo-xx.css a more reliable trick
- nso 13y agoOr the one I prefer, /Static/<vXX>/Css/Style.css. You rewrite all /Static/<vXX>/* URLs on the serverside to /Static/*. You could create a helper function which inserts the version number in URLs for static files, and use relative paths for images in the CSS file.
- philsnow 13y agoI like that too, seems cleaner I don't like "Css" though. If it's an acronym it should either be all capitalized or all non-capitalized.