websss
asked on
Forcing a Hard Refresh of cached website - in code?
Hi
Is there anyway (in code) to force a complete refresh of a website?
in a browser, I usually use ctrl F5
However, I need to the code to handle it on demand
Is this possible?
the idea is to write a cookie with the Version ID, and if the Version on the login page is different to that in the cookie then it must get a fresh copy and not use the cache
I know you can use Meta tags for No-cache etc, but would welcome some more insight
a possibility is to append the HTML with the no-cache meta tag (using asp.net) if the version ID's are different
but i'm not sure if its cross browser compliant etc
advice appreciated
Is there anyway (in code) to force a complete refresh of a website?
in a browser, I usually use ctrl F5
However, I need to the code to handle it on demand
Is this possible?
the idea is to write a cookie with the Version ID, and if the Version on the login page is different to that in the cookie then it must get a fresh copy and not use the cache
I know you can use Meta tags for No-cache etc, but would welcome some more insight
a possibility is to append the HTML with the no-cache meta tag (using asp.net) if the version ID's are different
but i'm not sure if its cross browser compliant etc
advice appreciated
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hello Websss,
You don't need to add any version in JS files.
Best Regards
You don't need to add any version in JS files.
Best Regards
ASKER
Really?
How would I stop the js file from caching using 2nd method ?
How would I stop the js file from caching using 2nd method ?
Ohh, sorry but if you want to prevent js file from caching then you have to use:
this will prevent from caching.
<script src="js.js?v=1"></script>
this will prevent from caching.
ASKER
great answer!
ASKER
Very interesting point about the ?v=1 on the CSS file
Does this also work on the Javascript files too?