请求 URL 的 Ajax 命令不再有效 [英] Ajax Command to request URL no longer working

查看:38
本文介绍了请求 URL 的 Ajax 命令不再有效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚更新了我的cordova版本.当我跑

I just updated my cordova version. When I run

cordova -v

它输出版本 5.0.0

It outputs version 5.0.0

在旧版本的 Cordova 上(我实际上不记得是什么版本)我能够使用 AJAX 从给定的 URL 请求数据.但是,更新 Cordova 版本后,它不再有效.在这次更新之后,我没有对代码进行任何编辑,所以我猜测新 Cordova 版本中的某些内容阻止了请求的通过.

On the older version of Cordova I had (I actually don't remember what version that was) I was able to use AJAX to request data from a given URL. However, after updating the Cordova version, it no longer works. I have made no edit to the code after this update, so I'm guessing something in the new Cordova version is preventing requests from going through.

我在 config.xml 文件中添加了以下访问权限:

I have added the following access grants in my config.xml file:

<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
    <allow-intent href="market:*" />
</platform>

但仍然没有运气.

有没有人遇到过类似的问题?知道如何让它再次工作吗?

Has anyone come across a similar issue? Any idea how I can get it working again?

谢谢,

推荐答案

原来我只是缺少以下插件:

Turns out I was just missing the following plugin:

cordova-plugin-whitelist

cordova-plugin-whitelist

我安装好后,rm android平台,重新添加android平台,编译运行,成功了!

After I installed it, rm the android platform, re-added the android platform, build and run, it worked!

这篇关于请求 URL 的 Ajax 命令不再有效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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