View Full Version : last modified challenge!!
kevin_huinink
05-19-2003, 04:27 PM
I want an HTML document to
dynamically post the 'last modified' date of another document on the
Internet.
eg. I upload our newsletter.pdf
The News page with a link to the pdf should read
"This file last updated/uploaded on ___________"
Possible?
brothercake
05-19-2003, 04:59 PM
Please read the posting guidelines - http://www.codingforums.com/postguide.htm - specifically the bit about choosing an appropriate title. Baiting for answers by dressing up your question as a "challenge" usually has the opposite effect from what you intended.
brothercake
05-19-2003, 08:32 PM
As to your question - no, you can't read the last modified date of an external document with javascript. But a server side language could do it.
jalarie
05-22-2003, 02:56 PM
Well, brothercake, yes and no. If the target file is on another domain, you're right. And if it's any type of file not normally displayed by a browser, you're right. But:
PopUp1=window.open('target.htm','x');
LM=PopUp1.document.lastModified;
alert(LM);
PopUp1.window.close();
jalarie
05-22-2003, 03:27 PM
Never being one to leave well-enough alone, I had to expand upon the above:
function GetLM() {
Targets=new Array(
'target1.htm',
'target2.htm',
'target3.htm',
'target4.htm'
);
PopUp1='';
Message='';
ix1=-1;
AddLM();
}
function AddLM() {
if ((PopUp1) && (!PopUp1.closed)) { PopUp1.window.close(); }
ix1=ix1*1+1*1;
if (ix1*1 < Targets.length) {
Target=Targets[ix1];
Opts='width=100,height=100';
PopUp1=window.open(Target,'x',Opts);
this.window.focus();
LM=Target+': '+PopUp1.document.lastModified;
Message+='\n'+LM;
TimeOut1=setTimeout("AddLM()",500);
} else {
alert(Message);
}
}
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.