Closed hq9000 closed 7 years ago
and another thing, when we load the ServerData.js initially (in the html code) we might want to add some anti-caching parameters (say, provided by an assets management system), like ?v=5
then, when the lib generates sample requests for itself it'd generage something like ServerData.js?v=5?noCache=123456 which is not a valid URL (two question marks).
I've changed it in our copy to add noCache through "&" but some generic solution would be nice to have too )
I'm open to your suggestions and would welcome a pull request.
https://github.com/NodeGuy/ServerDate/pull/33
I guess this is it.
Merged.
it's now just a client's timestamp. Right? I can imagine several clients with mismatched clocks doing the same request with the same parameter in astronomically different moments. Then, if it's not a browser cache we're talking about, or, rather some public cache or something, then the second, third... requests might get outdated cached response.
Wouldn't it be more reliable to add some randomness to this?
like so: // Ask the server for another copy of ServerDate.js but specify a unique number on the URL querystring // so that we don't get the browser cached Javascript file request.open("HEAD", URL + "?noCache=" + Date.now() + parseInt(Math.random()*100000));