Chrome tabs query returning empty tab array

Sounds like you’re running this code while your active window is devtools, which is a known bug. Another problem takes place in your code: it always accesses the focused (active) tab even though the request may have occurred in a backgrounded (inactive) tab. Solution: Use the tab id provided inside the listener function parameter as … Read more

How do I log out of a chrome.identity oauth provider

I am not aware about the specific third party provider. But I faced the similar problem when using Google Oauth with chrome.identity.launchWebAuthFlow(). I could sign in the user, but not sign out using removeCachedAuthToken() In this case, to logout the user, I used chrome.identity.launchWebAuthFlow() with Google’s logout URL rather than it’s oauth URL chrome.identity.launchWebAuthFlow( { … Read more

Persistent background page on demand or an event page that doesn’t unload?

Background pages cannot be unloaded on demand, and Chrome decides Event page lifecycle for you (there is nothing you can do in onSuspend to prevent it). If your concern is timers, you could try my solution from this answer, which basically splits a timer into shorter timers for a “sparse” busy-wait. That’s enough to keep … Read more

How to trigger click on a button

Try with this code; it simulates a mouse left click on the element by a quick succession of mousedown, mouseup and click events fired in the center of the button: var simulateMouseEvent = function(element, eventName, coordX, coordY) { element.dispatchEvent(new MouseEvent(eventName, { view: window, bubbles: true, cancelable: true, clientX: coordX, clientY: coordY, button: 0 })); }; … Read more