iemonslice
asked on
Display a file's last modified date on your webpage.
There exists a file C:\whatever\file.txt
How would I obtain the last modified time and date for this file using JavaScript?
How would I obtain the last modified time and date for this file using JavaScript?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Right, you'd have to use the file system object in ASP or something like that..
ASKER
K, can't do this using javascript.
Thank you for trusting me.
Here is a workaround which works only if the file is below the web servers root directory and your server support the lastModified attribute and the browser can access that document attribute:
<html>
<body>
<iframe name="theFile" src="whatever/file.txt" width=0 height=0"></iframe>
<b>File: </b>whatever/file.txt<br>
<b>Date Modified: </b>
<script>
document.write(window.fram es.theFile .document. lastModifi ed)
</script>
</body>
</html>
Good luck,
Zvonko
Here is a workaround which works only if the file is below the web servers root directory and your server support the lastModified attribute and the browser can access that document attribute:
<html>
<body>
<iframe name="theFile" src="whatever/file.txt" width=0 height=0"></iframe>
<b>File: </b>whatever/file.txt<br>
<b>Date Modified: </b>
<script>
document.write(window.fram
</script>
</body>
</html>
Good luck,
Zvonko