Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting value of "lastModified" function from remote file

Status
Not open for further replies.

sharapov

MIS
May 28, 2002
106
US
Is it possible to get value of the "document.lastModified" function from a file located in the same directory that the original? In other words let's say I have 3 files: index.htm, one.htm, two.htm. all in the same directory on the server. When I open my index.htm file is it possible to show when files one.htm and two.htm were modified last time?
 
sure...load them in a hidden iframe and read document.lastModified

<iframe style=&quot;display:none;&quot; src=&quot;one.htm&quot; id=&quot;oIFrame&quot;></iframe>
<span id=&quot;oSpan&quot;></span>

<script type=&quot;text/javascript&quot;>
function getLastModified() {
try {
var oIFrame = document.getElementById(&quot;oIFrame&quot;);
var oSpan = document.getElementById(&quot;oSpan&quot;);
oSpan.innerHTML = oIFrame.src + &quot; last modified &quot; +
oIFrame.document.lastModified;
} catch(E) {setTimeout(&quot;getLastModified();&quot;,50);}
}
getLastModified();
</script>

=========================================================
try { succeed(); } catch(E) { tryAgain(); }
-jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top