last modified date of a text file.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Boniface Frederic

    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.


  • Erwin Moller

    #2
    Re: last modified date of a text file.

    Boniface Frederic wrote:
    [color=blue]
    > Hi,
    >
    > Is it possible to know the last modified date of a text file in
    > javascript.
    >
    > Any help would be appreciated.
    >
    > Thanks.
    > Fred.[/color]

    Fred,

    Javascript typically cannot access files on the clients machine.
    Exception is the (crippled) javascriptsuppo rt 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 scriptinglangua ge 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

    Comment

    • Boniface Frederic

      #3
      Re: last modified date of a text file.

      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.


      Comment

      • Evertjan.

        #4
        Re: last modified date of a text file.

        Boniface Frederic wrote on 13 jul 2004 in comp.lang.javas cript:[color=blue]
        > 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.[/color]

        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","h ttp://my.org/robots.txt",fal se);
        x.send();
        document.write( '<pre>'+
        unescape(x.getA llResponseHeade rs()).replace(/&/g,"&<br>"));

        tested on ie6

        --
        Evertjan.
        The Netherlands.
        (Please change the x'es to dots in my emailaddress)

        Comment

        • Thomas 'PointedEars' Lahn

          #5
          Re: last modified date of a text file.

          Boniface Frederic wrote:[color=blue]
          > 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.[/color]

          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

          Comment

          • Erwin Moller

            #6
            Re: last modified date of a text file.

            Thomas 'PointedEars' Lahn wrote:
            [color=blue]
            > Boniface Frederic wrote:[color=green]
            >> 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.[/color]
            >
            > 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[/color]

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

            Regards,
            Erwin Moller

            Comment

            Working...