P
Peter Michaux
Hi,
I'm playing with dynamic script insertion to make a request to the
server for a JavaScript file to be automatically run when it arrives
in the browser. It works but...
The page caching is too good. When I revisit the page or refresh the
page, and then redo the script insertion, the browser doesn't even hit
the server to check for a newer version of the JavaScript file. The
same old script runs with each insertion.
If I insert the same script in a page repeatedly (without a page
reload) the server is not hit looking for a newer version but the
script does run each time.
If I attach a query string with a random number to the script's URL
then the server is hit. However if the script hasn't changed this is
an unnecessary waste of download because the cached version never gets
used.
Any ideas on getting caching working better for dynamic script
insertion?
Thanks,
Peter
I'm playing with dynamic script insertion to make a request to the
server for a JavaScript file to be automatically run when it arrives
in the browser. It works but...
The page caching is too good. When I revisit the page or refresh the
page, and then redo the script insertion, the browser doesn't even hit
the server to check for a newer version of the JavaScript file. The
same old script runs with each insertion.
If I insert the same script in a page repeatedly (without a page
reload) the server is not hit looking for a newer version but the
script does run each time.
If I attach a query string with a random number to the script's URL
then the server is hit. However if the script hasn't changed this is
an unnecessary waste of download because the cached version never gets
used.
Any ideas on getting caching working better for dynamic script
insertion?
Thanks,
Peter