当没有网络时,加载网络资源,如 http://www.baidu.com/ 就会出现白色的页面;这是不希望出现的结果;所以希望能加载自己本地的HTML;

则需要重写 webview 的onReceivedError 方法,让它重新加载本地HTML;

super.appView.setWebViewClient(new CordovaWebViewClient(this, appView) {
            @Override
            public void onReceivedError(WebView view, int errorCode,
                    String description, String failingUrl) {
                Log.i("failerror  no no my ",
                        "http://www.baidu.com/  is erro ,please check your network ......");
                loadUrl(launchUrl);
                super.onReceivedError(view, errorCode, description, failingUrl);

            }
        });

 

posted on 2015-01-12 14:23  ทดสอบ  阅读(769)  评论(0)    收藏  举报