admin管理员组文章数量:1188030
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?
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?
Share Improve this question edited Mar 4, 2014 at 15:11 Le_Coeur asked Feb 28, 2014 at 14:38 Le_CoeurLe_Coeur 1,5415 gold badges28 silver badges48 bronze badges 4 |3 Answers
Reset to default 19 +50You 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).
Click on Javascript Console from Tools menu.
Then enter the following:
javascript:alert(document.lastModified)
Current document timestamp:
var currentDocumentTimestamp = new Date(document.lastModified).getTime();
本文标签: javascriptGet the timestamp of loaded pageStack Overflow
版权声明:本文标题:javascript - Get the timestamp of loaded page - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738385390a2084155.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
document.lastModified
is based on the HTTPLast-Modified
response header, for example. – Myrne Stol Commented Mar 4, 2014 at 12:28