Document.body changes ignored only on android

This extension works fine on desktop. But on mobile, the browser action appears in the hamburger menu, but does nothing when I touch it.

I feel stuck because I have no way to debug on mobile.

You should be able to debug on Android using normal ADB debugging that is also used for webpages.

You can also use virtual device - install Android Studio, setup new empty project and then using Android Virtual Device Manager (AVD Manager) create new virtual device (pick one with Play Store support).
Then just download Firefox and set it up:

Also note that you need to use Firefox ESR 68 to debug current Firefox for Android.
And make sure to use web-ext, that makes testing much easier.

From my experience, usually the problem is that I’m using some API not available for Android, like browser.window.* and then the code fails because browser.window is undefined.

@juraj.masiar That link was just what I needed. Thanks!

I’m adding a listener to browser.contextMenus which I expect doesn’t exist on mobile, and browser.browserAction, which I expect does. Then manipulating document.body.

Now that I can debug on my own, I’ll probably figure it out. :slight_smile:

1 Like