Solved

last-modified for CGI-output...

Posted on 1997-12-10
6
223 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
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 Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 
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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

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…
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.
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 the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

809 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