ionic-team / ionic-team/capacitor-docs

Clarify limitations of Capacitor plugins in webView error html

Open
#540 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
MDX
Stars
48
Forks
792
Avg merge
2d 7h
Merged PRs (30d)
4

Description

In the [configuration reference](https://capacitorjs.com/docs/config) the comments on `server.errorPath` state that the `errorPath` html won't have access to Capacitor Plugins on Android:

https://github.com/ionic-team/capacitor-docs/blob/7eed09bd82bb60e734617b0a94812fd1da351450/docs/main/reference/config.md?plain=1#L684

But looking through the code handling the error page it seems to me that it is loaded into the webView just like the actual app page and thus should have access to Capacitor and plugins.

And indeed a short test by setting `server.errorPath` to `error.html` (and `android.minWebViewVersion` too high to trigger the error page) accessing plugins works just fine with this `error.html`:
~~~html





Device Name:


Capacitor.Plugins.Device.getInfo().then(info => {
document.querySelector('#name').textContent = info.name;
});

~~~

So is this comment deprecated and there are actually no restrictions in the error html?
Or in which conditions does it apply? Only certain error conditions, older devices/webViews, ...?
At least in this case accessing plugins actually _does_ work.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.