capacitor
capacitor copied to clipboard
Inject Capacitor JS for error fallbacks.
When using a local server.errorPath in conjunction with a remote server.url, and the device is offline, Capacitor does not inject its JS because allowedOrigin will be set to the remote server.url hostname, while the error is loaded from the local server. This means that plugins and other Capacitor/Cordova functionality are unavailable in this situation.
This PR adds https://localhost as an allowedOrigin, ensuring that all the Capacitor JS is being included in the error case.
There is a related PR for the case when the document start script feature is not supported: https://github.com/ionic-team/capacitor/pull/6247