javascript - How to invalidate cache for JS file loaded from bookmarklet? -
I have a bookmarklet that looks like this: I have the following in my The problem is that sometimes I make changes to For files loaded on my website, I cross the problem with the version of files, but I do not know how I can do with the bookmarklet.
javascript: (function () {var a = document.createElement ( "script"); a.type = "text / javascript"; a.src = "// example.com/script.min.js";a.charset="utf-8" ; Document.body.appendChild (a)}) ();
to allow .htaccess
file files to be cached:
& lt; IfModule mod_expires.c & gt; # Enable expirations # default instructions ExpiresDefault "access plus 1 month" # I favicon ExpiresByType image / x-icon "access plus 1 year" # images ExpiresByType image / gif "access plus 1 month" ExpiresByType image / png "access plus ExpiresActive months 1 the "ExpiresByType image / jpg" access plus 1 month "ExpiresByType image / jpeg" access plus 1 month "# CSS ExpiresByType text / css" reached 1 month "# JavaScript ExpiresByType application / javascript" access plus 1 month "& lt; / IfModule & gt;
script.js
and I think that people should get the update file to prevent problems To use the bookmarklet.
Clearly the client is not magically aware that you have updated the script unless Do not check this server.
You need to decide how much delay is acceptable to your server, the cost of the investigation is how to balance, and the idea that with an effort to solve the problem as you try to will do.
The easiest solution is the IMHO just change the cache time in one or two days
Also check "http etag" if done right, the client server will check every time , But the amount of data being transmitted should be trivial.
As you expand all ".js" universal do not want to change your mod_expires rules files, there is nothing in the world that says that you "script files for" Kjs "The client does not care.
Another solution is that the script file"? Attach a date string like "Dt = 2014-07-31-01: 00: 32", but you can craft the date string a fresh download once per day, or every few days, or once per week, Or months, or whatever.
Comments
Post a Comment