Solved

last-modified for CGI-output...

Posted on 1997-12-10
6
224 Views
Last Modified: 2013-12-25
I would like a cgi-program to output have a static last-modified date.  In Navigator, the last-modified date can be seen by selecting view-page info from the menu.

I tried a meta tag as follows, with no luck:
<META name="Last Modified" content="Sat, 26-Aug-95 21:57:56 GMT">
 
The CGI-program prints out the entire-page of the resultant-html.  

The server I am using is Netscape Enterprise 3.0, on NT and Solaris.
             
I have heard about server-parsed HTML(SSI) for APACHE but do not know more about it myself.

Rollin Crittendon
0
Comment
Question by:rollin
[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
6 Comments
 
LVL 1

Expert Comment

by:rets
ID: 1831607
Do you want this CGI to be "the page" or an element in the page.  It appears that you'd like to have the last modified info be a part of the existing page is this correct?

Also, what server are you working with?

Are you allowed to have SSIs (server parsed HTML)?

There are several possible solutions.  Answering these questions will allow for a solution which fits your needs better.
0
 

Author Comment

by:rollin
ID: 1831608
Edited text of question
0
 
LVL 1

Expert Comment

by:phutson
ID: 1831609
Why go through all of that how about a quick javascript.
just put this at the end of your page and it will do it.
<SCRIPT LANGUAGE="JavaScript">
<!--- Hide script from old browsers.
document.writeln("LastModified: " + document.lastModified)
// End the hiding here. -->
</SCRIPT>
I tested this on netscape 3.01
and ie 3.02

0
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 
LVL 1

Accepted Solution

by:
dagmar earned 50 total points
ID: 1831610
At long as you resist the temptation to follow up your 'Content-type: text/html' line with TWO carriage returns, you should be able to do this with what amounts to this (using your dates from the example above) as the first part of your CGI output:

Content-type: text/html
Last-modified: 26-Aug-95 21:57:56 GMT
(blank line)

My guess is that you're trying to log/examine browser information (or kludge some quick Virtual Hosting) and avoid the ugly 'cache-busting' properties that CGIs tend to have.  I had to do the same thing myself, because my pages were driving the automated web agents some of my people were using berzerk...

Note:  HTTP protocol has very specific requirements as to what exactly a Last-modified date can look like, and the format above (if I'm not mistaken) is exactly it, up to and including you must specify times in the GMT time zone.  To convert your local time (if you're in the USA) to GMT, just:

add 5 hours for Eastern Time
add 6 hours for Central Time
add 7 hours for Mountain Time
add 8 hours for Pacific Time
0
 
LVL 1

Expert Comment

by:dagmar
ID: 1831611
Oh, furthermore, you'll have a much easier task of converting the times to GMT accurately if you add hours*3600 to the mtime of the file in epoch seconds, and then convert the new epoch seconds into the required format...  
0
 

Author Comment

by:rollin
ID: 1831612
Is there a way to get HTML-header information into a page if I write directly from a daemon-program at a port as well?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
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.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

761 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