?
Solved

date of an html file

Posted on 1999-01-19
5
Medium Priority
?
223 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

Video: Liquid Web Managed WordPress Comparisons

If you run run a WordPress, you understand the potential headaches you may face when updating your plugins and themes. Do you choose to update on the fly and risk taking down your site; or do you set up a staging, keep it in sync with your live site and use that to test updates?

Question has a verified solution.

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

JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
This article discusses four methods for overlaying images in a container on a web page
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 receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

765 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