Detection of file edit dates

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • howardg@rbnz.govt.nz

    Detection of file edit dates

    I was wanting to use Javascript to detect the edit date on a series
    of .jpg files, and return that date in the corresponding HTML page,
    as in "Chart was last updated...". Does anyone know if this is
    possible, and if so how I would go about it?
    Many thanks
    Graham
  • erikd@nospam.wanted.here

    #2
    Re: Detection of file edit dates

    On 29 Nov 2004 17:04:18 +1300, howardg@rbnz.go vt.nz wrote:
    [color=blue]
    >I was wanting to use Javascript to detect the edit date on a series
    >of .jpg files, and return that date in the corresponding HTML page,
    >as in "Chart was last updated...". Does anyone know if this is
    >possible, and if so how I would go about it?[/color]

    I'm using a modified version of a script located at
    http://www.cgiscript.net/site_javascripts_date_time.htm to do it for
    the page, it should be possible to do the same for a file.

    --
    Erik

    Comment

    • Dr John Stockton

      #3
      Re: Detection of file edit dates

      JRS: In article <Xns95B0AD9A115 42howardgrbnzgo vtnz@172.27.20. 6>, dated
      Mon, 29 Nov 2004 17:04:18, seen in news:comp.lang. javascript,
      howardg@rbnz.go vt.nz posted :[color=blue]
      >I was wanting to use Javascript to detect the edit date on a series
      >of .jpg files, and return that date in the corresponding HTML page,
      >as in "Chart was last updated...". Does anyone know if this is
      >possible, and if so how I would go about it?[/color]

      If you use 32-bit Windows, and perhaps even if not, you can use
      Javascript in WSH to get the dates and to edit the HTML page; that
      answers your first question as stated.

      To answer your intended question, I doubted it. Testing locally, I see
      that document.images[0].fileCreatedDat e does show me a date string
      (not necessarily correct), so something like that *might* work on the
      Web for images that have actually been fetched.

      But for annotating links to images that might be fetched ...

      --
      © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
      <URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
      <URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
      <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.

      Comment

      • howardg@rbnz.govt.nz

        #4
        Re: Detection of file edit dates

        Dr John Stockton <spam@merlyn.de mon.co.uk> wrote in
        news:3r+B2FC6my qBFwLQ@merlyn.d emon.co.uk:
        [color=blue][color=green]
        >>I was wanting to use Javascript to detect the edit date on a series
        >>of .jpg files, and return that date in the corresponding HTML page,
        >>as in "Chart was last updated...". Does anyone know if this is
        >>possible, and if so how I would go about it?[/color]
        >
        > If you use 32-bit Windows, and perhaps even if not, you can use
        > Javascript in WSH to get the dates and to edit the HTML page; that
        > answers your first question as stated.
        >
        > To answer your intended question, I doubted it. Testing locally, I see
        > that document.images[0].fileCreatedDat e does show me a date string
        > (not necessarily correct), so something like that *might* work on the
        > Web for images that have actually been fetched.
        >[/color]
        Thanks for your reply - i'm a bit of a novice at this - are you able to
        be more specific in terms of the possible code for referencing a jpeg? Thanks
        again.

        Comment

        • RobB

          #5
          Re: Detection of file edit dates

          howardg@rbnz.go vt.nz wrote in message news:<Xns95B184 6033CF4howardgr bnzgovtnz@172.2 7.20.6>...[color=blue]
          > Dr John Stockton <spam@merlyn.de mon.co.uk> wrote in
          > news:3r+B2FC6my qBFwLQ@merlyn.d emon.co.uk:
          >[color=green][color=darkred]
          > >>I was wanting to use Javascript to detect the edit date on a series
          > >>of .jpg files, and return that date in the corresponding HTML page,
          > >>as in "Chart was last updated...". Does anyone know if this is
          > >>possible, and if so how I would go about it?[/color]
          > >
          > > If you use 32-bit Windows, and perhaps even if not, you can use
          > > Javascript in WSH to get the dates and to edit the HTML page; that
          > > answers your first question as stated.
          > >
          > > To answer your intended question, I doubted it. Testing locally, I see
          > > that document.images[0].fileCreatedDat e does show me a date string
          > > (not necessarily correct), so something like that *might* work on the
          > > Web for images that have actually been fetched.
          > >[/color]
          > Thanks for your reply - i'm a bit of a novice at this - are you able to
          > be more specific in terms of the possible code for referencing a jpeg? Thanks
          > again.[/color]

          The properties you'd be interested in - fileModifiedDat e /
          fileUpdatedDate are generally, by specification, members of Document
          objects, not Image objects. MSIE, naturally, breaks the pattern,
          making these available client-side for pix as well.

          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
          <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
          <head>
          <title>untitled </title>
          <script type="text/javascript">
          //<![CDATA[

          onload = function()
          {
          var img = document.getEle mentById('foo') ;
          var s1 = document.create TextNode('Last updated: ' +
          (img.fileUpdate dDate || 'unknown'));
          var s2 = document.create TextNode('Last modified: ' +
          (img.fileModifi edDate || 'unknown'));
          var d = document.getEle mentById('box') ;
          d.appendChild(s 1);
          d.appendChild(d ocument.createE lement('hr'));
          d.appendChild(s 2);
          }

          //]]>
          </script>
          </head>
          <body>
          <div id="box" style="width:20 0px;font:14px monospace;">
          <img id="foo" src="http://www.geocities.c om/area51/rampart/4503/acon/banana.jpg"
          />
          </div>
          </body>
          </html>

          Comment

          • Dr John Stockton

            #6
            Re: Detection of file edit dates

            JRS: In article <Xns95B1846033C F4howardgrbnzgo vtnz@172.27.20. 6>, dated
            Tue, 30 Nov 2004 13:01:09, seen in news:comp.lang. javascript,
            howardg@rbnz.go vt.nz posted :[color=blue]
            >Dr John Stockton <spam@merlyn.de mon.co.uk> wrote in
            >news:3r+B2FC6m yqBFwLQ@merlyn. demon.co.uk:
            >[color=green][color=darkred]
            >>>I was wanting to use Javascript to detect the edit date on a series
            >>>of .jpg files, and return that date in the corresponding HTML page,
            >>>as in "Chart was last updated...". Does anyone know if this is
            >>>possible, and if so how I would go about it?[/color]
            >>
            >> If you use 32-bit Windows, and perhaps even if not, you can use
            >> Javascript in WSH to get the dates and to edit the HTML page; that
            >> answers your first question as stated.
            >>
            >> To answer your intended question, I doubted it. Testing locally, I see
            >> that document.images[0].fileCreatedDat e does show me a date string
            >> (not necessarily correct), so something like that *might* work on the
            >> Web for images that have actually been fetched.
            >>[/color]
            >Thanks for your reply - i'm a bit of a novice at this - are you able to
            >be more specific in terms of the possible code for referencing a jpeg? Thanks
            >again.[/color]

            If I had known more, I would have written more.

            --
            © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 MIME. ©
            Web <URL:http://www.merlyn.demo n.co.uk/> - FAQish topics, acronyms, & links.
            Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
            Do not Mail News to me. Before a reply, quote with ">" or "> " (SonOfRFC1036)

            Comment

            • howardg@rbnz.govt.nz

              #7
              Re: Detection of file edit dates

              That's helpful, thanks very much!



              Comment

              Working...