PDA

View Full Version : [Slim-Checkins] r3655 - in trunk/server/HTML:Default2/html EN/html/jxtk



Peter Speck
2005-07-08, 13:28
On 08/07/2005, at 19:40, jacobdp (AT) svn (DOT) slimdevices.com wrote:

> Modified: trunk/server/HTML/Default2/html/postback.js
> ================================================== =================
> --- trunk/server/HTML/Default2/html/postback.js 2005-07-08
> 16:17:04 UTC (rev 3654)
> +++ trunk/server/HTML/Default2/html/postback.js 2005-07-08
> 17:40:36 UTC (rev 3655)
> @@ -25,14 +25,7 @@
> return;
> }
>
> - var ua = navigator.userAgent;
> - if (ua.indexOf("AppleWebKit/")) {
> - var wkversion = ua.substring(ua.indexOf("AppleWebKit/") +
> 12);
> - wkversion = wkversion.substring(0, wkversion.indexOf(" "));
> - if (wkversion <= 412 && wkversion > 126) {
> - url += '&safariworkaround=' + Date.parse(new Date);
> - }
> - }
> + url += '&nocache=' + Date.parse(new Date);
>
> req.open("GET", url);
> req.onreadystatechange = function() { postback_handler(req,
> url, handler); } ;
>


Instead of
url += '&nocache=' + Date.parse(new Date);
use
url += '&nocache=' + new Date().getTime();

Faster and better as it doesn't drop the milliseconds:


<script>
document.write("Date.parse(new Date) = " + Date.parse(new Date));
document.write("<br>");
document.write("new Date().getTime() = " + new Date().getTime());
</script>

produces:
Date.parse(new Date) = 1120845735000
new Date().getTime() = 1120845735193


----
- Peter Speck