• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 227
  • 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;">

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

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