How to detect if Chrome tab is crashed

I'm writing a extension for logging usage of Facebook. I found that even if the facebook tab crashed the timer still counting so trying to fix it. According to the doc, there seems no such event.

Is there API for detecting if the tab is crashed, or crash event?


The chrome.processes.onExited event is triggered when a renderer crashes (which is a process that hosts one or more tabs).

This API is only available to users on the developer channel, so if you want to make the extension widely available for everyone, then you need to use an alternative method. You could create a content script that creates a message port via chrome.runtime.connect , and in the onDisconnect event use chrome.tabs.sendMessage or chrome.tabs.executeScript to check whether the tab is still alive: If the tab does not exist any more, then chrome.runtime.lastError will be set and indicate a communication error.

链接地址: http://www.djcxy.com/p/80312.html

上一篇: 未定义的函数'distcomp.fileserializer'

下一篇: 如何检测Chrome标签是否崩溃