Parse the string.Date.parse returns milliseconds since the Unix epoch.
Compare numbers. Use > / < on ms, not on the raw string.
Store easily. Cookies or localStorage can keep a numeric timestamp.
Invalid parse. Failed parses yield NaN—check before comparing.
Compatibility
Browser Support
Document.lastModified is Baseline Widely available on MDN (since July 2015). It works across modern browsers and long-supported evergreen releases.
✓ Baseline · Widely available
Document.lastModified
Read-only date/time string for when the current document was last modified — parse with Date for comparisons.
99%Browser support
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
Android WebViewSupported · Modern WebView
Full support
lastModifiedExcellent
Bottom line: Safe everywhere you teach DOM APIs. Display the string freely; always parse before comparing. For external pages, prefer HEAD + Last-Modified.
Frequently Asked Questions
A string containing the date and local time when the current document was last modified (MDN).
No. MDN marks Document.lastModified as Baseline Widely available (since July 2015). It is a standard Document property.
Do not compare the strings directly. Convert with Date.parse(document.lastModified) or new Date(document.lastModified), then compare numbers or Date objects (MDN).
MDN shows storing a timestamp in a cookie and comparing it to Date.parse(document.lastModified) on later visits.
MDN suggests a HEAD request with fetch() and reading the Last-Modified response header.
No useful assignment — treat it as a read-only report of the document's last-modified time from the browser.