NodeGuy / server-date

Make the server's clock available in the browser.

Home Page:http://www.nodeguy.com/serverdate/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Browser caching causes incorrect ServerDate initialization

curby opened this issue · comments

commented

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

<script src="ServerDate.php"></script>

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.

Fixed in 16d946b.