Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

date of an html file

Posted on 1999-01-19
5
Medium Priority
?
228 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 100 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

609 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