Javascript behaving unexpectedly on FreeBSD

I have a small snippet of javascript that I add to my webpages
Code:
<center><script language="JavaScript" type="text/javascript">
if (Date.parse(document.lastModified) > 0) {
document.write ('<b>last modified: <\/b>' + document.lastModified +'<p>');
}
document.write('<b> url:<\/b>' + document.location.href + '<\/font><p>');
</script>

If I put the web page on a Linux host, it does what I expect, shows the last update for the page.
However, on a FreeBSD host, rather than show the latest update, it shows the last visit to the page.

I don't know javascript at all, I got this snippet years ago somewhere or other. At the time I had web pages on Linux and it did what I wanted. Is anyone who knows javascript inclined to tell me what should be different on a FreeBSD host? On FreeBSD, it's in a jail, but I don't see how that would be relevant. This happens whether I use Nginx or Apache, and worked on Linux with either web server.
 
fyi, <center>, <font> and "language" in <script> have been marked obsolete for a decade or more. <script> defaults to javascript so you can leave "type" off altogether. But none of that will fix your problem.

The operating system has nothing to do with javascript which runs in the browser alone except in certain modern cases that don't involve this.

After staring at this a while, I think document.lastModified might be the source of the issue. Last modified since when? Does Linux handle the time the same as FreeBSD?
 
@drhowardfine, I don't know. And thanks for the other comments.

sko I'm not sure. I created it during installation, and then created the jail a couple of days ago. I'll have to check and get back to you on that one.
(have to check how to check that, which will be a good learning experience for me, as it's something I feel I should know already).
 
And, this is odd. Suddenly it is behaving correctly, at least on a few random pages I looked at. srobb.net still has last date looked at (that's at a datacenter, also on a FreeBSD jail). The www.scottro.net was on Linux until a few days ago, (RHEL-10.0) and was showing the correct date. But right now, the current www.scottro.net is also showing the correct date. I'm going to wait a bit before marking it solved though.
 
If I put the web page on a Linux host, it does what I expect, shows the last update for the page.
However, on a FreeBSD host, rather than show the latest update, it shows the last visit to the page.
Could it be something like atime/relatime Linux not updating file access timestamps?
 
Back
Top