最佳的WebView设置HTML5的支持? [英] Optimal WebView Settings for HTML5 Support?

查看:329
本文介绍了最佳的WebView设置HTML5的支持?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我感兴趣的是确定最佳的设置是干什么用一个web视图,旨在展示HTML5的内容。

I'm interested in determining what the optimal settings are for a WebView that is intended to show HTML5 content.

目前我使用的:

mWebView.setFocusable(true);
mWebView.setFocusableInTouchMode(true);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setPluginsEnabled(true);
mWebView.getSettings().setRenderPriority(RenderPriority.HIGH);
mWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
mWebView.getSettings().setDomStorageEnabled(true);
mWebView.getSettings().setDatabaseEnabled(true);
mWebView.getSettings().setAppCacheEnabled(true);
mWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);

使用这些设置,web视图得分189(W / 1奖金)在 html5test.com 。我想知道,如果有,我应该/可以改变,以获得与HTML5的兼容性的任何设置。当然,这份名单是设置编过几个月的合并,所以我也欢迎被告知,我做错了什么。我没有过要显示的HTML内容的控制,但我试图尽可能广泛支持HTML5的一大片地。

With these settings, the WebView score 189 (w/ 1 bonus) on html5test.com. I am wondering if there are any settings that I should/could change to get further compatibility with HTML5. Of course, this list is an amalgamation of settings compiled over some months, so I'm also open to being told I'm doing something wrong. I do not have control over the html content to be displayed but am trying to support as broad a swath of HTML5 as possible.

推荐答案

我要补充:

    mWebView.setWebViewClient(new WebViewClient()); // tells page not to open links in android browser and instead open them in this webview

这篇关于最佳的WebView设置HTML5的支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆