获取加载页面的时间戳 [英] Get the timestamp of loaded page
问题描述
在javascript或Chrome扩展API中,是否有方法可以立即(在加载时没有保存时间戳)获取页面DOM何时加载到Chrome的时间戳? div class =h2_lin>解决方案
您可以使用 performance.timing
对象(由所有现代浏览器实现,Safari除外)获取各种不同的时间戳。您需要查看为自己什么时间戳最适合你。 当页面被加载时是一个相当模糊的描述。否则,请更具体。
如果您不想经历Chrome内容脚本与Chrome背景页面通信的问题,还可以使用< Chrome浏览器导航API 。然而,这只会暴露事件,因此您将负责保存此事件触发时(每页)的时间。
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?
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).
这篇关于获取加载页面的时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!