0 Favourites

Phonegap Ajax

  • 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="*" />

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • 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.

  • 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="*" />

  • 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

  • matty100 - that is unrelated to this thread. Please start a new thread in Website Issues.

  • 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!!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)