NodeGuy / server-date

Make the server's clock available in the browser.
http://www.nodeguy.com/serverdate/
Mozilla Public License 2.0
193 stars 52 forks source link

Browser caching causes incorrect ServerDate initialization #21

Closed curby closed 9 years ago

curby commented 9 years ago

The PHP script appends the current timestamp and sends it to the client as part of the javascript request

and the resulting script is cached by the browser along with its initializing epoch timestamp.

If you navigate away from the page that loaded ServerDate and then later revisit by hitting the back button, the cached script (with now-obsolete timestamp) is used to initialize the clock.

This skews the initial target as well as the offset of the first sample retrieved from the server during the first synchronization of the newly-reloaded ServerDate object.

NodeGuy commented 9 years ago

Fixed in 16d946b4a04a3a264cffeb23df9dd17e4c78ee03.