访问控制 - 允许 - 产地误差的Andr​​oid 4.1误差、产地、访问控制、oid

2023-09-12 23:46:18 作者:损友i

我有问题,访问控制 - 允许 - 产地在安卓4.1

I have problems with Access-Control-Allow-Origin at Android 4.1

在我的应用程序有一些本地HTML文件和Javascript语言,我用来从Web服务的数据。直到想的Andr​​oid 4.1也没有问题,但试图在安卓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);