I need to synchronize a date returned from ASP.NET with a date returned from JavaScript. So, I send the date from the server in a hidden field, then get the new Date() from JavaScript and obtain the time offset. Only approximation of the time difference is needed.
All works well when the page first loads -- the server date stored in the hidden field and the value form JavaScript "match". But, when I navigate from the page and then click the Back button, the page now comes from browser cache, so the server value is outdated as compared to the JavaScript date.
Is there any way to make the two dates consistent -- both taken from cache or both not taken from cache? I guess I need a kind of client-side page modified date, which would not change if the page comes from the browser cache. I tried document.lastModified, but that changes when a page comes from cache.
Thank you.