Hello, more and more, on the forum, there are posts where folks cannot see changes after updating, or buttons do not work.
One way to overcome this is to add a revision number to your links to these files.
This works for all of today's browsers and is a good way to force the new changes, as long as you don't mind incrementing the version number when you make changes.
<link rel="stylesheet" href="css/ectcart.css?ver=1">
So I came across this post by Peter over at Servelink (regarding .php) and thought it's quite brilliant.https://www.ecommercetemplates.com/support/topic.asp?TOPIC_ID=114770&whichpage=2
On a Unix/Linux server, you can also automate that with something like this:
<link rel="stylesheet" href="css/ectcart.css?ver=<?php echo filemtime('css/ectcart.css'); ?>">
<script src="js/ectcart.js?ver=<?php echo filemtime('js/ectcart.js'); ?>"></script>
which will print the Unix timestamp of when the file was last modified. Update the file and the timestamp will change, forcing the browser to fetch a fresh copy.
I thought about this for .asp and there is no built in function for .asp to handle this, but it is possible to create one.
Keep in mind this is for .asp versions running on a windows server.
In the beginning of the <head> of your pages, just insert the code below and append your css and js links with a small entry similar to the .php example Peter posted.
This code will lookup the timestamp on your files and use that for the revision number. When you upload new versions of these files, users will always get the new version and those frustrating cache issues will be gone forever.
Here is the code you will place in the <head> section of your pages.
'begin css and js file versioning
' instructions and support here - https://www.ecommercetemplates.com/support/topic.asp?TOPIC_ID=114969
'************DO NOT EDIT ANY CODE BELOW************************
Function dgttwo(value, digits)
if digits > len(value) then
dgttwo = String(digits-len(value),"0") & value
dgttwo = value
if ververf.FileExists(""& Server.MapPath("\") &"\"&verfelcs&"") then
set verf=Server.CreateObject("Scripting.FileSystemObject").GetFile(""& Server.MapPath("\") &"\"&verfelcs&"")
versnno = Year(verf.DateLastModified)&dgttwo(Month(verf.DateLastModified),2)&dgttwo(Day(verf.DateLastModified),2)
versnno = "0000"
'end css and js file versioning
Then you just adjust your css and js links like so
<link rel="stylesheet" href="css/ectcart.css?ver=<%=versnno("css/ectcart.css")%>
<link rel="stylesheet" href="css/style.css?ver=<%=versnno("css/style.css")%>
Just load it up and view source on the page and you should see the date of the file used as the version number.
This code is free to use and not officially supported by ect. However I use it on my very busy website and it's working great and I am here for support if you have questions or issues. It will not be overwritten by updates.
Thanks and enjoy.