我在 Android 4.1 上遇到 Access-Control-Allow-Origin 问题
I have problems with Access-Control-Allow-Origin at Android 4.1
在我的应用程序中,我有一些本地 HTML 文件和 Javascript,用于从 Web 服务获取数据.在尝试 Android 4.1 之前没有问题,但在尝试 Android 4.1 之后出现此错误.
In my application i have some local HTML files and Javascripts which i was using to fetch data from web services. Until trying Android 4.1 there was no problem but after trying at Android 4.1 i got this error.
我阅读了很多文档,但找不到解决此问题的方法.
I read lots of documents but i couldn't find a way to solve this problem.
你需要做类似的事情
if (Build.VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN)
wv.getSettings().setAllowUniversalAccessFromFileURLs(true);
这篇关于Android 4.1 的访问控制允许来源错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!