ÇäÔÇÁ ÕÝÍÉ ÎØÇ 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 doesn’t work. You need to use a file-based URL. Maybe that’s assumed by the docs, but it wasn’t 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/