android webview 使用js加载json文件失败
16lz
2021-01-23
在android 的webview中使用js加载json文件报如下异常:
04-12 08:46:37.658: E/Web Console(929): XMLHttpRequest cannot load file:///android_asset/data/jca_data.json. Origin null is not allowed by Access-Control-Allow-Origin. at null:1
这是因为webview的web setting需要做如下设置:
webSettings.setAllowUniversalAccessFromFileURLs(true);
更多相关文章
- Android 加载大图片是出现的 OutOfMemoryError问题
- Android Studio中R文件丢失
- 文件浏览器
- Android签名文件生成
- android获取指定路径下目录文件
- android之PopUpWindow显示Listview(文件列表)