[Zope] javascript and last modified date

J Cameron Cooper jccooper@jcameroncooper.com
Mon, 24 Feb 2003 15:36:41 -0600


>
>
>>  > javascript in my zope have problems with document dates:
>>  > document.write(document.lastModified)
>>  >
>>  > returns 1970...
>>  >
>>  > Is there something I have forgotten? In zope or Linux (on which my 
>> zope is
>>  > running)
>>
>> This looks like a pure Javascript question/problem with no Zope or
>> Linux involved.
>
> I apologize.
> I assumed the javascript method somehow got hold on the "las modified 
> date" from the webserver (but of courde: how it would do this I do not 
> know).

While document.lastModified is indeed a DOM thing, it doesn't seem 
unreasonable that Zope's property of similar name be available. I don't 
know where a browser would be expected to get that from specifically, 
though no doubt it's some HTTP header. A very-quick Mozilla search 
indicates it might be 'last-modified' in the response:

http://lxr.mozilla.org/seamonkey/source/content/html/document/src/nsHTMLDocument.cpp#789

So try RESPONSE.setHeader('last-modified', some_time) with the document 
you're running your Javascript on and see what that does for you.

I can't watch HTTP conversations right now, but if Zope doesn't try 
this, I think it probably should, and if it does, but it doesn't work, 
it should definitely be fixed. Consider filing a Collector issue in 
either case. (A quick Zope source search shows no instance of 
last-modified in ZPublisher.)

Also, if you post the appropriate code fragments, others can test more 
easily to see if this is a problem with your setup or in general.

          --jcc