1

我必须为 Android 和 iOs 开发一个应用程序。为此,我需要使用跨域 ajax 请求,因为我使用 Phonegap 进行开发。问题如下:当我从浏览器使用 html / css / js 代码时,即使是智能手机浏览器,我也能从我的服务器正确地得到答案。但是,当我在编译的 Phonegap 应用程序上使用相同的代码执行相同的请求时,我会收到 403 Forbidden 响应,尽管我在服务器端有标题“Access-Control-Allow-Origin: *”。

我一直在互联网上寻找解决方案,但我发现没有线程谈论这种问题。有人有想法吗?

问候,

4

2 回答 2

1

I suspect u are using PhoneGap version 2.3.0 or lower . In this case you need to white list All external domain access must be white listed in PhoneGap in 2.3.0 or lower versions. Otherwise PhoneGap blocks them by default. See full details here: http://docs.phonegap.com/en/2.3.0/guide_whitelist_index.md.html#Domain%20Whitelist%20Guide . In 2.4.0 version of PhoneGap, all domains are whitelisted by default.

于 2013-02-25T03:11:35.073 回答
0

我知道它已经很久了,但我对 403 禁止响应有类似的问题。但在我这边是文件权限,将其更改为 755,现在一切正常。

于 2016-05-12T10:50:47.863 回答