Solved

date of an html file

Posted on 1999-01-19
5
215 Views
Last Modified: 2013-11-18
Is there any way we can include the date of the html file automatically??

Also, is it possible to check the date of a file (other than the html itself) and put it into a html??

TIA
-=Terence=-
0
Comment
Question by:kachan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 1

Expert Comment

by:chump
ID: 1845427
If your Server handles "Server Side Includes" (SSI), put a
 <!--#flastmod file="foo.html" -->
in your HTML-Code.
(more info on SSI using Apache Webserver can be found here:
http://www.apacheweek.com/features/ssi).

0
 
LVL 1

Expert Comment

by:chump
ID: 1845428
If you like to use JavaScript, you can also use this code for the date of the current HTML-File:

<SCRIPT LANGUAGE="JavaScript">
<!--
var x= new Date(document.lastModified);
document.writeln(x.toString());
// -->
</SCRIPT>

0
 

Author Comment

by:kachan
ID: 1845429
In fact, the way that you shown can only indicate the date of the current html, but I am actually trying to get the date for a gif file that I am going to display.

TIA
-=Terence=-

0
 
LVL 1

Expert Comment

by:chump
ID: 1845430
True for the Javascript-part. But with SSI:
 <!--#flastmod file="displayed.gif" -->
or
 <!--#flastmod virtual="/pics/displayed.gif" -->

0
 

Accepted Solution

by:
DannyAyers earned 50 total points
ID: 1845431
Unfortunately there is not a suitable property in Javascript for images, although there is for document - so call the image as a document. A possible workaround would be along the lines of :

<SCRIPT language="javascript">
      window2=open("Cat.gif","secondWindow","scrollbars=no");
      window.document.write(window2.document.lastModified.toString());
      window.focus();
//      window2.close();
</SCRIPT>

with image Cat.gif in same dir.

This should work with a bit of tweaking - I had to click reload. The focus pulls the interesting window to front. At some point you probably will want the close(), but where it is (on my browser at least) it loses the value.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question