Closed
Bug 322297
Opened 19 years ago
Closed 3 years ago
document.lastModified returns current time for remote file
Categories
(Core :: DOM: Core & HTML, defect, P5)
Tracking
()
RESOLVED
INACTIVE
People
(Reporter: habere, Unassigned)
References
()
Details
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050922 Firefox/1.0.7 (Ubuntu package 1.0.7) Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050922 Firefox/1.0.7 (Ubuntu package 1.0.7) document.lastModified should return the start of epoch if no last-modified http header is sent. according to johnny stenback in bug 116,598 comment 16[1], it looks like we've made "document.lastModified = now when no last-modified header is sent. This should make us compatible with IE." (april 2003) that makes it impossible(?) to tell if a document is undated. well established tests now fail: <script type="text/javascript"> if (Date.parse(document.lastModified) != 0) document.write('Last modified: ' + document.lastModified); </script> david flanagan, in _javascript the definitive guide_ 4th edition page 559: ---8<--- lastModified is a read-only string property that contains the date and time at which document was most recently modified. This data is derived from HTTP header data sent by the web server. The web server generally obtains the last-modified date by examining the modification date of the file itself. Web servers are not required to provide last-modified dates for the documents they serve. When a web server does not provide a last-modified date, JavaScript assumes 0, **which translates to a date of midnight, January 1, 1970, GMT**. The following example shows how you can test for this case. [emphasis mine; equivalent example removed] --->8--- neither microsoft's[2], nor mozilla's[3] documentation mention this edge case. i think netscape 4.x sets a clear dom0 precedent[4]. this bug makes scripts such as peter-paul koch's last modified date[5] lie with: "Page last changed today" (firefox 1.5 & nightly) when in reality we've no idea when it was last modified since there's no last-modified header. i'd welcome a workaround that doesn't involve a ridiculous second http request via XMLHttpRequest for what should have been accurately reported first time round. is compatibility with ie behaviour this important? - p -- tested under firefox 1.5 & 1.6a1 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a1) Gecko/20060103 Firefox/1.6a1 1. Bug 116598 - document.lastModified doesn't show the "date" header if no "last-modified" header is sent https://bugzilla.mozilla.org/show_bug.cgi?id=116598#c16 2. lastModified Property (document) (Internet Explorer - DHTML) http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/lastmodified.asp 3. DOM:document.lastModified - MDC http://developer.mozilla.org/en/docs/DOM:document.lastModified 4. http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/document.html#1193811 http://web.archive.org/web/20040603154112/http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/document.html#1193811 5. JavaScript - Last modified http://www.quirksmode.org/js/lastmod.html Reproducible: Always Steps to Reproduce: Actual Results: Page last changed today Expected Results: Page last changed 36 years ago If PPK's script was modified to include the standard test in the example given -- then it could have reported: "Page not dated."
Comment 1•18 years ago
|
||
Confirmed. http://lxr.mozilla.org/seamonkey/source/content/base/src/nsDocument.cpp#4927
Status: UNCONFIRMED → NEW
Ever confirmed: true
Updated•15 years ago
|
Assignee: general → nobody
QA Contact: ian → general
Comment 2•6 years ago
|
||
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046 Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5. If you have questions, please contact :mdaly.
Priority: -- → P5
Updated•3 years ago
|
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INACTIVE
You need to log in
before you can comment on or make changes to this bug.
Description
•