Hi All,
My extension would like to keep track of the internet connection status, I found this navigator.online attribute and event
https://developer.mozilla.org/en-US/doc ... ine_events
But it is related to the content page (using window.navigator...), and event registering would be like "window.addEventListener("offline", func)".
The shortcoming is if I have 10 tabs opened, then the connection is down, the offline event will be triggered 10 times
Is there any other API to achieve this in the background? So I will only get one event if the connection status change
Thanks
Can extension get connection status in background?
-
- Posts: 4
- Joined: January 13th, 2016, 11:00 am
-
- Posts: 3664
- Joined: September 15th, 2010, 9:03 am
Re: Can extension get connection status in background?
For an addon, use the observer notification network:offline-status-changed. The data value contains the string "online" or "offline" in case you didn't remember it.
-
- Posts: 4
- Joined: January 13th, 2016, 11:00 am
Re: Can extension get connection status in background?
That's it, Thank you very much lithopsian:)lithopsian wrote:For an addon, use the observer notification network:offline-status-changed. The data value contains the string "online" or "offline" in case you didn't remember it.