[英]WebView console shows errors on android < 4.0 | (JVectorMap)
I have an issue that's a bit strange... I have a server API where I've installed JVectorMap javascripts to show some stats on maps. 我有一个奇怪的问题...我有一个服务器API,在其中安装了JVectorMap javascript,以在地图上显示一些统计信息。 it's very simple I just have to set the url to the webview like this:
这非常简单,我只需要将网址设置为如下所示的webview:
(WebView Config) (WebView配置)
WebView wv = (WebView)lv_header.findViewById(R.id.result_webview);
WebSettings settings = wv.getSettings();
settings.setBuiltInZoomControls(false);
settings.setUseWideViewPort(true);
settings.setJavaScriptEnabled(true);
settings.setLoadsImagesAutomatically(true);
settings.setDomStorageEnabled(true);
settings.setLoadWithOverviewMode(true);
wv.setHorizontalScrollBarEnabled(false);
WebView method I call to show map 我调用以显示地图的WebView方法
private void setWebView(String countryCode) {
wv.loadUrl( MyApplication.API_URL_SERVER_PRODUCTION+"/query/"+getIdFromPos(array_id, posInArray)+"/map/"+countryCode);
}
On Android 4.x > will show ok everything is ok but under 4.x I have this log; 在Android 4.x上>将显示ok,但一切正常,但是在4.x下,我有此日志; (And the webView is blank):
(并且webView为空白):
E/Web Console(8411): Uncaught TypeError: Object #<an HTMLDocument> has no method: 'createStyleSheet' at http://www.miwebsite.com/static/js/jvectormap/jquery-jvectormap-1.2.2.min.js:7
Method 'createStyleSheet' it's in the "jquery-jvectormap-1.2.2.min.js" file... 方法“ createStyleSheet”位于“ jquery-jvectormap-1.2.2.min.js”文件中...
Example of a map ==> Click Here 地图示例==> 单击此处
In jVectorMap uncompressed there is a call to document.createStyleSheet()
javascript function at line #182: 在未压缩的jVectorMap中,在第#182行有一个对
document.createStyleSheet()
javascript函数的调用:
jvm.VMLElement.initializeVML = function () {
try {
document.namespaces.rvml || document.namespaces.add("rvml", "urn:schemas-microsoft-com:vml"), jvm.VMLElement.prototype.createElement = function (e) {
return document.createElement("<rvml:" + e + ' class="rvml">')
}
} catch (e) {
jvm.VMLElement.prototype.createElement = function (e) {
return document.createElement("<" + e + ' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')
}
}
document.createStyleSheet().addRule(".rvml", "behavior:url(#default#VML)"), jvm.VMLElement.VMLInitialized = !0
}
The function is not jVectorMap specific, is specific to the javascript implementation in the IE browser, until IE 11. It's possible you're using a browser that doesn't support this (maybe you're sending the IE user agent string from your Android browser). 该函数不是特定于jVectorMap的,而是特定于IE浏览器中的javascript实现的,直到IE 11为止。可能您使用的浏览器不支持此功能(也许是从Android发送IE用户代理字符串)浏览器)。
Use this uncompressed jVectorMap (copy, paste and save it in a file and use it to replace the minified jVectorMap you currently are using) and see what line is causing the problem. 使用此未压缩的jVectorMap (将其复制,粘贴并保存到文件中,并用其替换您当前使用的缩小的jVectorMap),然后查看引起此问题的行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.