访问控制 - 允许 - 产地误差的Andr​​oid 4.1 [英] Access-Control-Allow-Origin Error At Android 4.1

查看:148
本文介绍了访问控制 - 允许 - 产地误差的Andr​​oid 4.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有问题,访问控制 - 允许 - 产地在安卓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);

这篇关于访问控制 - 允许 - 产地误差的Andr​​oid 4.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆