问题
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?
回答1:
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).
回答2:
Click on Javascript Console from Tools menu.
Then enter the following:
javascript:alert(document.lastModified)
回答3:
Current document timestamp:
var currentDocumentTimestamp = new Date(document.lastModified).getTime();
来源:https://stackoverflow.com/questions/22098117/get-the-timestamp-of-loaded-page