使用WebView开发,调用了assets目录下的一个页面,从这个页面连接到另外一个页面,一直报错,
Access-Control-Allow-Origin Error
if (Build.VERSION.SDK_INT >= 16) {
Class<?> clazz = webView.getSettings().getClass();
Method method = clazz.getMethod("setAllowUniversalAccessFromFileURLs", boolean.class);
if (method != null) {
method.invoke(webView.getSettings(), true);
}
}