Solved

date of an html file

Posted on 1999-01-19
5
210 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
  • 3
5 Comments
 
LVL 1

Expert Comment

by:chump
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
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 Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now