Reputation: 1541
Is there a way in javascript or in chrome extension API to instantly (without saving the timestamp during the loading time) get the timestamp of when the DOM of the page was loaded in Chrome?
Upvotes: 12
Views: 9408
Reputation: 18937
Current document timestamp:
var currentDocumentTimestamp = new Date(document.lastModified).getTime();
Upvotes: 2
Reputation: 11438
You can use the performance.timing
object (implemented by all modern browsers, except Safari) to get all kinds of different timestamps.
You need to see for yourself what timestamp would be most appropriate for you. "when the page was loaded" is quite a vague description. Otherwise, be more specific.
If you don't to go through the trouble of having a Chrome content script communicate with a Chrome background page, you can also use the Chrome webNavigation API. However this only exposes events, so you'd be responsible for saving the time when this event is fired (for each page).
Upvotes: 19
Reputation: 1188
Click on Javascript Console from Tools menu.
Then enter the following:
javascript:alert(document.lastModified)
Upvotes: 6