Cordova ErrorUrl 404 error -
Phone Gap / Cordova



error page

, config

:
<preference name="ErrorUrl" value="file:///android_asset/www/error.html" />
100 % ,

file /// android_asset

error.html www

www 404



404

404

crash

If set, will display the referenced page upon an error in the application instead of a dialog with the title "Application Error".

file:/// is a URI (Uniform Resource Identifier) that simply distinguishes from the standard URI that we all know of too well - http://.
It does imply an absolute path name pointing to the root directory in any environment, but in the context of Android, it's a convention to tell the Android run-time to say "Here, the directory www has a file called index.html located in the assets folder in the root of the project".
That is how assets are loaded at runtime, for example, a WebView widget would know exactly where to load the embedded resource file by specifying the file:/// URI.
Consider the code example:
WebView webViewer = (WebView) findViewById(R.id.webViewer);
webView.loadUrl("file:///android_asset/www/index.html"); A very easy mistake to make here is this, some would infer it to as file:///android_assets, notice the plural of assets in the URI and wonder why the embedded resource is not working!
:


:
<preference name="ErrorUrl" value="myErrorPage.html"/>
, .

The docs say it should be located in file://android_asset/www/. So I made a file, error.html, and tried this:
<preference name=errorUrl value=error.html />
But that doesnt work. You need to use a file-based URL. Maybe thats assumed by the docs, but it wasnt clear to me. This is what works:
<preference name=errorUrl value=file:///android_asset/www/error.html />
I mentioned to Simon that this setting seems a bit extreme. I mean, why would I link to and use the wrong URL, but certainly in a real application with some size in it this would be possible.
:

https://www.raymondcamden.com/2013/0...onfig-Settings
https://stackoverflow.com/questions/...ndex-html-mean
https://cordova.apache.org/docs/en/1...arted/android/