Stu Janis
Stu Janis

Reputation: 3

css files delay before updating

I'm using Dreamweaver to update a website. When I upload the style.css file, Safari and Chrome don't recognize the changes for a while. Here's what I'm doing.

The problem is that Safari and Chrome aren't recognizing the changes on the server. I saw a suggestion to call the stylesheet with href="css/style.css?v={random number/string}" rel="stylesheet" type="text/css", but that didn't seem to help.

If I wait long enough (5-10 minutes), eventually things get updated. Is there a way to get instantaneous css updates to the browsers?

Upvotes: 0

Views: 1923

Answers (2)

wtave
wtave

Reputation: 1

Thank you for this post. The solution worked for me.

This oen:

<link rel="stylesheet" type="text/css" href="/css/style.css?ver=2.0">

Upvotes: 0

dkrasniy
dkrasniy

Reputation: 408

The browsers are caching the CSS file to be more efficient and have no idea that changes have been made.

The versioning you mentioned in the original question should do the trick. Keep in mind it needs to be changed (to whatever you want) every time you want the browser to re-fetch it.

<link rel="stylesheet" type="text/css" href="/css/style.css?ver=2.0">

Upvotes: 1

Related Questions