Hi all,
Does anyone know of a way to cause the browser to clear cache programmatically? I've been using the Mass Update plugin in my app and find that frequently the functions don't work if the browser cache is not cleared. If I press Control+Shift+Refresh browser then the function will work. I'm wondering if I could include some code somewhere that would automatically clear the browser cache when a page is accessed?
Thanks for any help.
Ray
Programmatically Clear Browser Cache
Re: Programmatically Clear Browser Cache
I think for security reasons it's impossible to force client side updates skipping cache from a server-side script.
If possible, when including scripts or stylesheets use a unique filename. You may include a version number or a timestamp.
I'm doing this from time to time and a while ago I've asked Ahmed to implement it for hooks. I think for -dv and -tv hooks it's implemented since latest version.
If someone knows a solution, this would really help.
If possible, when including scripts or stylesheets use a unique filename. You may include a version number or a timestamp.
myscript.js?v=20241206221957
I'm doing this from time to time and a while ago I've asked Ahmed to implement it for hooks. I think for -dv and -tv hooks it's implemented since latest version.
If someone knows a solution, this would really help.
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 25.10 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 25.10 + all AppGini Helper tools
Re: Programmatically Clear Browser Cache
Hi Jan,
In searching the web I find that you could potentially insert Meta tags into a page to prevent caching. Is there a way to test this out by forcing the tags into the generated pages in AppGini??
<meta http-equiv='cache-control' content='no-cache'>
<meta http-equiv='expires' content='0'>
<meta http-equiv='pragma' content='no-cache'>
Thanks,
Ray
In searching the web I find that you could potentially insert Meta tags into a page to prevent caching. Is there a way to test this out by forcing the tags into the generated pages in AppGini??
<meta http-equiv='cache-control' content='no-cache'>
<meta http-equiv='expires' content='0'>
<meta http-equiv='pragma' content='no-cache'>
Thanks,
Ray
Re: Programmatically Clear Browser Cache
As far as I know different browsers behave differently, but maybe I have missed something.
If anyone here could provide a browser independent solution, I'd be happy.
For performance reasons, instead of completely disabling caching I would prefer controlling certain files like certain scripts and certain stylesheets.
If anyone here could provide a browser independent solution, I'd be happy.
For performance reasons, instead of completely disabling caching I would prefer controlling certain files like certain scripts and certain stylesheets.
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 25.10 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 25.10 + all AppGini Helper tools
- D Oliveira
- AppGini Super Hero
- Posts: 357
- Joined: 2018-03-04 09:30
- Location: David
Re: Programmatically Clear Browser Cache
Client side caching should be considered outside of your control, you could pass a timestamp to load the js file like Jan mentioned `?id=123+timestamp()` OR if you truly wanna have control on that data you can save it on the php session a trigger param and manipulate via server side what gets rendered/loaded by invalidating the cache only when the session var changes because that would change the param being passed.
Re: Programmatically Clear Browser Cache
By the way: by chance I've seen that, in deed, AppGini nowadays appends a file timestamp when lazy loading javascripts:
TV:
DV:
That's a big step forward, if you ask me!
Thank you, Ahmed!
TV:
<script src="hooks/tasks-tv.js?1733732438"></script>
DV:
<script src="hooks/tasks-dv.js?1733641674"></script>
That's a big step forward, if you ask me!
Thank you, Ahmed!
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 25.10 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 25.10 + all AppGini Helper tools