Eureka ! I found how to obtain a date with Opera ...
To avoid that the browser tries to read the image lastModified in the cache, you have only to call
This could be applied too to the image src...Code:dt=LastModUsingHeader('upload.jpg?'+Math.random()); // or to modify the function function LastModUsingHeader(U) { var X = !window.XMLHttpRequest ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest; X.open('GET', U+'?'+Math.random(), false); try{ X.send();}catch(y){} var dt=X.getResponseHeader('Last-Modified'); return new Date(dt).toLocaletring(); } // to write <p>Image uploaded: <i id="ImageDate"></i></p> <script type="text/javascript"> document.getElementById('ImageDate').innerHTML=LastModUsingHeader('upload.jpg'); </script>
It would be better to have a DOCTYPE for the page (See W3C) and to display meta tags to control the cache (See this page) to choose a Meta tag...
Otherwise the users could have difficulties to update the page...HTML Code:<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"> <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">


Reply With Quote

Bookmarks