Website Last Modified Date

Is there a way to get the Last-Modified-Date file on a website?

i.e. Here is an example of the file that I have: http://www.ymcadetroit.org/atf/cf/%7B2101903E-A11A-4532-A64D-9D823368A605%7D/Birmingham_Youth_Sports_Parent_Manual.pdf

+7
html
source share
9 answers

Go to the website you want to know about, wait for it to be fully downloaded, then go to the address bar and write the following:

javascript:alert(document.lastModified) 

A pop-up window will appear that will be displayed on the last change.

+8
source share

HTTP calls the Last-Modified field to announce the date of the last modification. But the server must know this date.

In static files, the contents of which are sent directly to the client and are not interpreted otherwise by the server (for example, .html , .css , .js ), it uses the last modified date of this file. But in files that generate content dynamically (PHP, Python, etc.), the script must specify this information itself. But, unfortunately, many scenarios do not fit this.

So, if the Last-Modified header field is present, you can use this information. But if not, you cannot determine the date of the last modification.

+6
source share

I understand that this question is 4 years old, but an Internet search has shown that satisfactory answers remain rare. Peter's answer is part of the solution. When I had the same problem to solve, it made me start. But the rest is the solution ...

As he said, the web server must be set up to send the date with the last change ... so how do you set up the web server?

Assuming that you have the necessary level of control, you must first enable the server side. There are several ways to do this - one of them is xbithack. Good link http://httpd.apache.org/docs/current/howto/ssi.html .

Assuming you did this, you need to set the execution bit in any html file that the server part should have, which includes parsing. This can be done on the command line of a UNIX-like system: chmod u+x file.html or on a Mac using get-info (command-I) in the file.

This leaves a snippet for actual placement in your file, which looks like this:

This document last modified <!--#flastmod file="index.html" -->

Since I found many, many recommendations that did not include this, and just used javascript document.lastModified , I suspect that some servers give you what you want with the javascript version, while some (including the one ) do not do.

+5
source share

Here is the C # code for this:

 public DateTime GetLastModifyTime(string url) { WebRequest request = WebRequest.Create(url); request.Credentials = CredentialCache.DefaultNetworkCredentials; request.Method = "HEAD"; using (WebResponse response = request.GetResponse()) { string lastModifyString = response.Headers.Get("Last-Modified"); DateTime remoteTime; if (DateTime.TryParse(lastModifyString, out remoteTime)) { return remoteTime; } return DateTime.MinValue; } } 
+4
source share

To get the last modified date from the client side, you can access the HTML DOM using the lastModified property using JavaScript.

The lastModified property captures information from the head part sent by all web requests. The value may be set manually by the developers on the web server side, so it may not reflect the actual last modified date of the file responsible for delivering the content.

Example

 <!DOCTYPE html> <html> <body> <b>document.lastModified : </b> <script>document.write( document.lastModified );</script> </body> </html> 

The specific JavaScript command that retrieves this is document.lastModified and can be easily converted to a Date object as follows:

 var x = new Date(document.lastModified); 

More information can be found on the site I used as the w3 link : HTML DOM lastModified Property

+3
source share

I believe that the web server should be configured to send the date of the last change in the HTTP header, this is certainly one way. Section 14.29 Last modified by this document:

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

+2
source share

With simple HTML, you cannot.

You can use PHP or ASP or any other server language.

0
source share

I am not an expert in headlines, but I believe that you are looking for this:

There is a way to check the date the file was modified: View HTTP headers in Google Chrome?

Check there (Chrome Developer Tools / Network / Selected File / Headers) the "If-Modified-Since" variable.

So far, it has helped me achieve what you ask for, get the file modification date.

0
source share

To get the latest change, you can do the following: https://superuser.com/a/991895

Using curl:

 curl -s -v -X HEAD http://foo.com/bar/baz.pdf 2>&1 | grep '^< Last-Modified:' 

Using wget:

 wget --server-response --spider http://example.com/bar/example.pdf 2>&1 | grep -i Last-Modified 
0
source share

All Articles