Jump to content

Comparing lastmodified dates of external files...any ideas?

- - - - -

  • Please log in to reply
No replies to this topic

#1
erdubya

erdubya

    Newbie

  • Members
  • Pip
  • 1 posts
I'm having trouble figuring out how to compare last modified dates of an external file in javascript.

What i'm trying to accomplish is this:

0. nondescript php code executed here...
1. wait (random 120-240 secs)
2. copy lastmodified_date to old_lastmodified_date.
3. check last modified date of projectvibe.net/pvsamsite/songChange.txt
4. if last_modified_date > old_lastmodified_date then refresh page, otherwise repeat step 1.



I got as far as capturing the last modified date of the external file but that's it. Can someone please help me? Thanks!

<html>

<head>

<title>Last Modified</title>

<script type="text/javascript">

function getLastMod(){

var doc;

var myFrm = document.getElementById('myIframe');

var doc;


if ((doc = myFrm.contentDocument)

|| (myFrm.contentWindow && (doc = myFrm.contentWindow.document))) {

/* ... */

}

var lastModif = new Date(myFrm.contentWindow.document.lastModified);

document.getElementById('LastModified').innerHTML = "Prices correct as at: " + lastModif.toLocaleString();

}

</script>

</head>

<body>

<span id="LastModified"></span>


<iframe id="myIframe" onload="getLastMod()" src="projectvibe.net/pvsamsite/songChange.txt" style="display:none;">

</iframe>


<span id="LastModified"></span>

</body>

</html>






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users