Firefox Adds Listener for Browser Error

I use the online add-on builder to create a small add-on. We can get the page and url loading using this: https://addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/tutorials/listen-for-page-load.html

I tested above and it works.

But how to add a listener for browser error messages, such as Problem loading page (if the Internet connection fails). I want to catch this error (for example, the warning "error loading page"). how is this possible?

+6
source share
2 answers

It doesn't seem to be any Jetpack-specific function for this kind of thing, so you might be stuck in one of these much more detailed and low-level solutions. But I don’t know what I'm talking about, so maybe post to mozilla.dev.extensions before taking the floor on this. :) Good luck!

+2
source

This js can be entered -

 window.onerror = function(message, url, linenumber) { alert("Err"+message); } 
-2
source

All Articles