473,486 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

last modified date of a text file.

Hi,

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

Any help would be appreciated.

Thanks.
Fred.
Jul 23 '05 #1
5 4229
Boniface Frederic wrote:
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
Jul 23 '05 #2
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.
Jul 23 '05 #3
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

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #4
Boniface Frederic wrote:
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
Jul 23 '05 #5
Thomas 'PointedEars' Lahn wrote:
Boniface Frederic wrote:
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


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

Regards,
Erwin Moller
Jul 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
7243
by: robinpg.SHU | last post by:
As title really, does anyone know of (or could write?) a php file which in a directory of .jpg files display the most recent added to that /dir? Can anyone help?
1
3210
by: Amanda | last post by:
Hi, hope you can help me with this one. If I want to get the date a page has been last modified, I can do something like .. document.write("<b>Last updated: "+document.lastModified+"</b>"); ...
11
3605
by: Dennis Marks | last post by:
There seems to be a major program with the automatic display of the last modified date. Using the javascript "document.lastModified" sometimes returns the correct date and sometimes 1 Jan 1970...
7
41032
by: laredotornado | last post by:
Hello, Does anyone know how (or if) I can figure out the last time a web page was last modified if my only access to it is via HTTP (a web browser). Right now, I'm looking at "Page Info" options....
5
2517
by: Steel | last post by:
Hi at all it is the first time that I use PHP and I need only to modify the last modified date of a file I maked a FIRST little script like this: $FileName="myfile.txt"; $Today...
6
3941
by: SQLcat | last post by:
I have a VBScript as follows: Dim xmlHTTP : Set xmlHTTP = CreateObject("Microsoft.XMLHTTP") Dim adoStream : Set adoStream = CreateObject("adodb.stream") Const bGetAsAsync = False ' wait for...
102
6682
by: hug | last post by:
www.webmaster, was suggested that this ng could be a better place.] I've updated my test server to handle if-modified-since. I've noticed that the (old copies I run of) IE and Netscape seem...
3
7149
by: RAMohrmann | last post by:
Greetings, I am attempting to view all files in a directory and if those files have not been modified within the last couple days I will remove them. In order to do this I need to look at the...
1
2162
by: Svetac | last post by:
Hi, I use a script that shows when the page was last modified. It works fine for just one html file. The thing I would like to do is that the script shows me of last modified file in root...
3
3318
by: Gretsch | last post by:
Web, html, javascript, Hi, I need to calculate the time since this .htm file was last modified. {which I can then use in a calculation, rather than display, so days&decimals format would be OK}...
0
7094
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7123
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7173
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7305
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5427
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3066
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
259
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.