获取加载页面的时间戳 [英] Get the timestamp of loaded page

查看:119
本文介绍了获取加载页面的时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆