mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-01 02:12:58 +08:00
Handle unsupported protocol errors in webview better
This commit is contained in:
parent
2ab81bc5ae
commit
25b8d360da
@ -259,7 +259,19 @@ public class CordovaWebViewClient extends WebViewClient {
|
|||||||
// Clear timeout flag
|
// Clear timeout flag
|
||||||
this.appView.loadUrlTimeout++;
|
this.appView.loadUrlTimeout++;
|
||||||
|
|
||||||
// Handle error
|
// If this is a "Protocol Not Supported" error, then revert to the previous
|
||||||
|
// page. If there was no previous page, then punt. The application's config
|
||||||
|
// is likely incorrect (start page set to sms: or something like that)
|
||||||
|
if (errorCode == WebViewClient.ERROR_UNSUPPORTED_SCHEME) {
|
||||||
|
if (view.canGoBack()) {
|
||||||
|
view.goBack();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
super.onReceivedError(view, errorCode, description, failingUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle other errors by passing them to the webview in JS
|
||||||
JSONObject data = new JSONObject();
|
JSONObject data = new JSONObject();
|
||||||
try {
|
try {
|
||||||
data.put("errorCode", errorCode);
|
data.put("errorCode", errorCode);
|
||||||
|
Loading…
Reference in New Issue
Block a user