JoaMika
JoaMika

Reputation: 1827

Safari CSS - Invalidate ?ver for custom stylesheet

I am using a function to give a unique version for my custom style sheet, each time I make changes. This is referenced in my source code as:

https://www.example.com/wp-content/themes/x-child/style.css?ver=1539545953

Also I have prevented this file from being cached on my server.

I thought that Safari would automatically download the latest version, but instead it seems that the user needs to manually empty the caches, and then refresh the page to get the latest version of my stylesheet in Safari.

Is there a way to force Safari to invalidate the old stored file in the browser cache? I thought by using versioning, this would automatically work without clearing the cache manually.

Upvotes: 0

Views: 198

Answers (1)

Poyraz Alkan
Poyraz Alkan

Reputation: 69

into

<head>
</head>

tags so that it is active only on safari or all browsers

<meta http-equiv = "Cache-Control" content = "no-cache, no-store, must-revalidate" />
<meta http-equiv = "Pragma" content = "no-cache" />
<meta http-equiv = "Expires" content = "0" />

tags and prevent page caching so that each resource will be recalled at any time
But, don't forget that this cache gives us a lot of speed if possible by removing these codes after the development is done to improve the user experience.

Upvotes: 1

Related Questions