last modified date of a text file.

B

Boniface Frederic

Hi,

Is it possible to know the last modified date of a text file in javascript.

Any help would be appreciated.

Thanks.
Fred.
 
E

Erwin Moller

Boniface said:
Hi,

Is it possible to know the last modified date of a text file in
javascript.

Any help would be appreciated.

Thanks.
Fred.

Fred,

Javascript typically cannot access files on the clients machine.
Exception is the (crippled) javascriptsupport for input elements named
"FILE" in forms for uploadpurposes.

What is it excactly you want to accomplish?
If you are talking serverside you could maybe do a little simple scipting
(every serverside scriptinglanguage I know of supports this).

If you are talking clientside: I think: No.

Reason for this is that javascript can be executed by every weppage, so your
filesystem needs some protection for this.

Solution:
If you want a webpage to access the clients filesystem, use Java.
Remember that the client still must give his/her permission to such an
applet to do so!

Regards,
Erwin
 
B

Boniface Frederic

Hi Erwin,

I want it server side. I would like to use this to know if new data are
available on the server since my last check, if true, I update the web page.
 
E

Evertjan.

Boniface Frederic wrote on 13 jul 2004 in comp.lang.javascript:
I want it server side. I would like to use this to know if new data
are available on the server since my last check, if true, I update the
web page.

You can see the last modified date of a file on the server two ways

1 serverside code. that depends on the platform [asp, php, ...]

2 clientside code [here in javascript], read the headers:

var x = new ActiveXObject("Msxml2.XMLHTTP");
x.open("GET","http://my.org/robots.txt",false);
x.send();
document.write('<pre>'+
unescape(x.getAllResponseHeaders()).replace(/&/g,"&<br>"));

tested on ie6
 
T

Thomas 'PointedEars' Lahn

Boniface said:
I want it server side. I would like to use this to know if new data are
available on the server since my last check, if true, I update the web page.

How and whether this can be accomplished depends on the server that
you are using. However, your approach seems quite weird. If you have
server-side scripting available, why do you not just use that to embed
content generated from server-side data?


PointedEars
 
E

Erwin Moller

Thomas said:
How and whether this can be accomplished depends on the server that
you are using. However, your approach seems quite weird. If you have
server-side scripting available, why do you not just use that to embed
content generated from server-side data?


PointedEars

Maybe he is trying to include webpages on somebody else's server..
Naughty!
;-)

Regards,
Erwin Moller
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top