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?
Getting the Current Time Stamp If you instead want to get the current time stamp, you can create a new Date object and use the getTime() method. const currentDate = new Date(); const timestamp = currentDate. getTime(); In JavaScript, a time stamp is the number of milliseconds that have passed since January 1, 1970.
Just check the time the page was last loaded using Chrome's History page, if it was enabled and not cleared ( Menu > History and recent tabs > History , ctrl+H or about:history ).
timeStamp. The timeStamp read-only property of the Event interface returns the time (in milliseconds) at which the event was created.
In javascript, the timestamp is one of the formats that can be achieved with the help of some default methods like Date() instance by using this date object it retrieves the date and also holds the time in the readable formats we can create the new object by using Date() method also it includes the timestamps it shows ...
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With