Phonegap Cordova Ajax 请求 404(未找到)错误 [英] Phonegap Cordova Ajax requests 404 (Not Found) Error

查看:48
本文介绍了Phonegap Cordova Ajax 请求 404(未找到)错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的cordova版本是5.0.0

My cordova version is 5.0.0

当应用程序部署在设备上时,我收到所有 ajax 请求的 404 错误.在网络浏览器上,它工作正常,但部署在设备上的同一个应用程序不起作用.

I am getting a 404 error for the all ajax request made when the app is deployed on the device. On the web browser, it works fine but same app when deployed on a device does not work.

我尝试添加以下内容来解决问题,但没有帮助.

I tried adding following to solve the issue but it hasn't helped.

Config.xml

<access origin="*" />

AndriodManiest.xml

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

我还在 index.html 文件中添加了以下内容,但也没有任何区别.

I also added following in my index.html file but it didn't make any difference either.

<script>
    $.support.cors=true;
</script>

这里有人有解决这个问题的另一种技巧吗?,这似乎是 phonegap 的一个很常见的问题,但上述修复程序在旧版的 phonegap/cordova 中有效,但在我的情况下没有一个有效.

Anyone here has another trick to solve this issue?, Seems to be a quite common issue with phonegap but the fixes above worked in older vesion of the phonegap/cordova but non of them has worked in my case.

任何帮助都会很棒.

推荐答案

我遇到了同样的问题,不得不安装cordova-plugin-whitelist

I had the same issue and had to install the cordova-plugin-whitelist

cordova plugin add cordova-plugin-whitelist

信用转到这篇 stackoverflow 文章 - Ajax 命令请求 URL 否工作时间更长

Credit goes to this stackoverflow article - Ajax Command to request URL no longer working

这篇关于Phonegap Cordova Ajax 请求 404(未找到)错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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