1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > android 4.4 webview加载部分https网页白屏

android 4.4 webview加载部分https网页白屏

时间:2023-11-22 11:31:05

相关推荐

android 4.4 webview加载部分https网页白屏

private void initWebview(){//mWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);//mWebView.setLayerType(View.LAYER_TYPE_NONE, null);//设置支持jsmWebView.getSettings().setJavaScriptEnabled(true);//设置渲染效果优先级,高mWebView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);//设置缓存模式mWebView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);String cacheDirPath = APP_CACAHE_DIRNAME;//设置数据库缓存路径mWebView.getSettings().setDatabasePath(cacheDirPath);//设置 应用 缓存目录mWebView.getSettings().setAppCachePath(cacheDirPath);//开启 DOM 存储功能mWebView.getSettings().setDomStorageEnabled(true);//开启 数据库 存储功能mWebView.getSettings().setDatabaseEnabled(true);//开启 应用缓存 功能mWebView.getSettings().setAppCacheEnabled(true);mWebView.getSettings().setAppCacheEnabled(true);mWebView.setWebChromeClient(new WebChromeClient());//这行最好不要丢掉mWebView.loadUrl("https://ggzy./xjy/Jyxt/MeetingRoomDoorPlate.aspx?area=4&type=1");Log.d("hhhhhhhhhhh","onCreate.....................");//mWebView.loadUrl("");//设置响应超链接,在安卓5.0系统,不使用下面语句超链接也是正常的,但在M安卓4.4.4中需要使用下面这条语句,才能响应超链接mWebView.setWebViewClient(new WebViewClient(){@Overridepublic boolean shouldOverrideUrlLoading(WebView view, String url) {// TODO Auto-generated method stubview.loadUrl(url);Log.d("hhhhhhhhhhh","shouldOverrideUrlLoading.....................");return true;}@Overridepublic void onReceivedSslError(WebView view,SslErrorHandler handler, SslError error) {// TODO Auto-generated method stub//super.onReceivedSslError(view, handler, error);Log.d("hhhhhhhhhhh","onReceivedSslError.....................");handler.proceed(); //接受所有证书}});}

注:(以下两点是主要修改)

mWebView.getSettings().setDomStorageEnabled(true);

mWebView.setWebViewClient 中的两个方法必须实现

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。