我的应用程序中的一项活动上有一张地图。
我Leaflet用作我的地图,为了使用它,我使用了WebView.
然后,在我的代码中,我使用:
String Map_HTML = "<html>\n" +
"<head>\n" +
"\n" +
" <title>Quick Start - Leaflet</title>\n" +
"\n" +
" <meta charset=\"utf-8\" />\n" +
" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n" +
TONS OF HTML HERE
" color: 'red',\n" +
" fillColor: '#8275FE',\n" +
" fillOpacity: 0.3,\n" +
" weight: '0'\n" +
"}).addTo(mymap);\n" +
"\n" +
"\n" +
"var popup = L.popup();\n" +
"\n" +
"</script>\n" +
"\n" +
"</body>\n" +
"</html>";
WebView MapView = (WebView) findViewById(R.id.wb_map);
WebSettings webSettings = MapView.getSettings();
webSettings.setJavaScriptEnabled(true);
MapView.loadData(Map_HTML, "text/html", null);
在我使用的脚本的最后,webSettings.setJavaScriptEnabled(true);它给出了一个警告:
Using setJavaScriptEnabled can introduce XSS vulnerabilities into your application, review carefully.
从我读到的内容来看,有些人收到消息play store,要求他们更新应用程序,这样就不会出现这种情况了。
由于我的目标是尽快发布应用程序,我想知道是否可以选择在没有这条线的情况下运行它?
我试图删除它,但它只是没有在 WebView 中显示任何内容。
谢谢