I need to calculate the browser using time in an extension. If i can check whether the browser is active or not, then it is easy to calculate the time. How is this possible in crossrider?
var focused = true;
window.onfocus = window.onblur = function(e) {
focused = (e || event).type === "focus";
}
alert(focused);
i tried this code in background.js but it always display "true" even if i minimize the browser window.