• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 214
  • Last Modified:

document.lastmodified of document through iframe.

I have an html page called main.html that displays different html tables which I'll call (standard.htm, nonstandard.htm, substandard.htm) through an iframe.

I want to write a last updated date that is at the top of main.html but show the last document.lastmodified of standard.htm
1 Solution
<script type="text/javascript">
function getLastMod(){
var myFrm = document.getElementById('myIframe');
var lastModif = new Date(myFrm.contentWindow.document.lastModified);
document.getElementById('LastModified').innerHTML = "Modified at: " + lastModif.toLocaleString();
<span id="LastModified"></span>

<iframe id="myIframe" onload="getLastMod()" src="standard.htm" style="display:none;">


Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now