Phonegap Ajax

Bugs will be moved here once resolved.

Post » Sun Oct 25, 2015 1:00 pm

Problem Description
With the new Phonegap builds, all Ajax traffic is blocked in my app.

Attach a Capx
Any ajax call in the new phonegap build will fail.

Description of Capx
None included

Steps to Reproduce Bug
  • Mke an ajax call

Observed Result
Ajax fails to trigger on fail or on success.

Expected Result
Ajax success or fail.

Affected Browsers
  • Chrome:NO
  • FireFox: NO
  • Internet Explorer: NO

Operating System and Service Pack
Windows 10

Construct 2 Version ID
release 216 64 bit

In order to fix it I needed to add the whitelist plugin by adding the following to my config.xml file. Can you look into including this by default?
<gap:plugin name="cordova-plugin-whitelist" source="npm" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<allow-navigation href="*" />
www.h1k3.tech

We are here for you!
B
90
S
24
G
16
Posts: 716
Reputation: 17,032

Post » Mon Oct 26, 2015 2:11 pm

I don't know if i a a same problem, but ajax in r216 64bit with windows 7 bugs. I tried to save scores with a script php in sql database. i do a request url, after my scores is save in my database, but he enter the ajax error trigger and the code next does'nt effected(because the next code is a complete trigger). I'm install r212-2version. Now it's work find without change code.

I hope i clear and sorry for my bad english. Good continuation.
B
7
S
1
Posts: 44
Reputation: 487

Post » Thu Nov 12, 2015 12:05 pm

Does your server support CORS? By default if your server is not sending Access-Control-Allow-Origin HTTP headers, cross-origin requests are blocked.

Your workaround basically involves disabling that entire security measure, and I don't want to do that if it's just a CORS issue with your own server.
Scirra Founder
B
403
S
238
G
89
Posts: 24,659
Reputation: 196,165

Post » Thu Nov 12, 2015 8:16 pm

Ashley wrote:Does your server support CORS? By default if your server is not sending Access-Control-Allow-Origin HTTP headers, cross-origin requests are blocked.

Your workaround basically involves disabling that entire security measure, and I don't want to do that if it's just a CORS issue with your own server.



It's not a workaround. It's how the new phonegap is working. They are requiring that we whitelist the ip addresses that our android phones will use. It's a new thing added to newer phonegap versions. Each of my php scripts allow incoming traffic from anywhere through access allow headers set to *. This isn't a Cors issue it's a newer phonegap issue.
www.h1k3.tech

We are here for you!
B
90
S
24
G
16
Posts: 716
Reputation: 17,032

Post » Fri Nov 13, 2015 12:26 pm

According to the whitelist plugin documentation, the "allow-navigation" tag only whitelists origins for navigating the webview itself, which should not affect AJAX requests. It sounds like the <access origin="*"> tag would do that instead. A new beta is going out today so I'll add in this and we'll see if it makes a difference:

<gap:plugin name="cordova-plugin-whitelist" source="npm" />
<access origin="*" />
Scirra Founder
B
403
S
238
G
89
Posts: 24,659
Reputation: 196,165

Post » Sun Nov 22, 2015 2:49 pm

sorry to interrupt but: when I check my profile it says "matty100's arcade games:"
and then after it it shows nothing when i published 2 games already.

I know it is a bit out of topic in this forum but pls fix

Scirra member, Matty100
B
12
S
2
G
1
Posts: 15
Reputation: 1,121

Post » Mon Nov 23, 2015 11:30 am

@matty100 - that is unrelated to this thread. Please start a new thread in Website Issues.
Scirra Founder
B
403
S
238
G
89
Posts: 24,659
Reputation: 196,165

Post » Mon Nov 23, 2015 6:42 pm

thanks for telling me I didn't know there is a forum for that and I think there is a forum for everything now I know that!! :lol: :mrgreen:
B
12
S
2
G
1
Posts: 15
Reputation: 1,121


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 5 guests