Closed
Bug 266426
Opened 20 years ago
Closed 20 years ago
The javascript which displays the last date of the modification doesn't work correctly
Categories
(Firefox :: General, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: stephanemaillard, Assigned: bugzilla)
References
()
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr-FR; rv:1.7.3) Gecko/20041027 Firefox/1.0RC1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr-FR; rv:1.7.3) Gecko/20041027 Firefox/1.0RC1
Here is the code of the javascript:
<script language="javascript">
<!--
date=document.lastModified
jour=date.charAt(3)+date.charAt(4)
mois=date.charAt(0)+date.charAt(1)
annee=date.charAt(6)+date.charAt(7)+date.charAt(8)+date.charAt(9)
document.write("<I>Last update : "+mois+"/"+jour+"/"+annee)
//-->
</script>
This bug occurs only under FireFox, that works very well with Internet Explorer
and Netscape.
Reproducible: Always
Steps to Reproduce:
1. Go on this address (http://fly.simvol.org/rechercheus.php)
2. Near the "Last update" mention, you can see the bug
3.
Actual Results:
Instead of displaying the correct format of the date, FireFox displays anything.
Comment 1•20 years ago
|
||
1. That URL returns a 404 Not Found page. 2. No page that I could find on the site includes document.lastModified 3. document.lastModified takes its value from the Last-Modified HTTP header, which PHP pages don't send unless you send it manually. 4. document.lastModified returns a localized string: for me, "Thursday, October 28, 2004 23:28:00", so taking charAt() from it will give you quite awful results. ->INVA
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
Updated•20 years ago
|
Status: RESOLVED → VERIFIED
| Reporter | ||
Updated•20 years ago
|
Status: VERIFIED → UNCONFIRMED
Resolution: INVALID → ---
Summary: The javascript which displays the last date of the modication doesn't work correctly → The javascript which displays the last date of the modification doesn't work correctly
Comment 2•20 years ago
|
||
Ah, that changed URL works better, but doesn't change anything about the nature of document.lastModified: it's a string property, part of DOM0 which means there's no standard for how it's structured, and you can't just take characters from particular indexes and expect to get the same thing in every browser. If you want to deal with it programmatically, you need a Date object, by either saying x = Date(document.lastModified) or if you are more careful something like if(0 != (x=Date.parse(document.lastModified))). Though I still don't see a Last-Modified header that would cause it to actually have a useful date.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago → 20 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•