如何识别一个标签正在重新加载,我的意思是实际的页面重新加载 [英] How to identify a tab is reloading, I mean actual page reload

查看:197
本文介绍了如何识别一个标签正在重新加载,我的意思是实际的页面重新加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何识别一个标签重新加载,我的意思是实际的页面重新加载?
我看到 chrome.tabs.onUpdated event ,但是对于这个事件状态来说,即使在来自网页的AJAX调用的情况下也是加载。
如何检测页面重新加载?

How to identify a tab is reloading, I mean actual page reload? I see chrome.tabs.onUpdated event, but for this event status is 'loading' even in case of AJAX calls from a webpage. How can I detect a page is getting reloaded ?

推荐答案

您说得对,看起来好像不可能识别AJAX和页面重新载入调用。作为解决方法,您可以监听选项卡网页的onunload事件。你可能需要检查一下tabid和url是否被改变。

You are right, looks like not possible to recognize AJAX and page reload calls. As workaround you could listen for onunload event for tab webpage. You probably need to check if tabid and url were not changed after that.

但是你真的需要知道页面是否重新加载?

But do you really need to know if page reloaded?

这篇关于如何识别一个标签正在重新加载,我的意思是实际的页面重新加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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