How do I usa ajax without crosswalk?

0 favourites
  • 5 posts
From the Asset Store
15 x USA WW2 plane sprites with 2 x damage models per plane and matching shadows
  • Hello, I am using ajax request to retrieve data from my webserver. When I use it on C2 preview it works fine. When I compile it using plugin cordova-plugin-crosswalk-webview it works fine on my mobile too. Only when I compile without crosswalk it does not work, going to ajax->on error and returning no data.

    I am testing on Android, exporting on cordova and compiling on phonegap.

    I do not want to use crosswalk as my app size goes from 3mb to 33mb. Any idea what is going on?

    This is my code:

    This is my config.xml that does not work.

    <?xml version="1.0" encoding="UTF-8"?>

    <widget xmlns="" xmlns:gap="" id="com.gaminiuk.InfobrasFSe" version="2.0.1">



    <author email="">Gaminiuk Corporation</author>

    <icon src="icon-128.png" width="128" height="128" />

    <icon src="icon-256.png" width="256" height="256" gap:role="default" />

    <preference name="permissions" value="none"/>

    <preference name="android-targetSdkVersion" value="29" />

    <feature name=""/>

    <feature name=""/>

    <preference name="orientation" value="portrait" />

    <preference name="fullscreen" value="true" />

    <gap:config-file platform="ios" parent="UIStatusBarHidden"><true/></gap:config-file>

    <gap:config-file platform="ios" parent="UIViewControllerBasedStatusBarAppearance"><false/></gap:config-file>

    <preference name="deployment-target" value="8.0" />

    <plugin name="cordova-plugin-whitelist" source="npm" />

    <access origin="*" />

    <plugin name="cordova-plugin-barcodescanner" source="npm" />

    <plugin name="cordova-plugin-inappbrowser" source="npm" />

    <!-- -->

    <!-- <gap:splash src="splash.png" width="1024" height="768" /> -->


  • This counts as a cross-domain request. See the manual entry for AJAX which covers that. The server probably also needs to be secure too (HTTPS).

    P.s.: Crosswalk was deprecated years ago, you shouldn't be using it at all any more.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi Ashley, thank you for really quick reply!

    Indeed, it really seems that server is blocking ajax requests. I already tried using "Access-Control-Allow-Origin" on my php file and "set request header" as bellow:

    I cannot use SSL on this server as it is our ERP and might cause some bugs on it.

    Odd thing is that AJAX is working perfectly on another projects, same server, same structure.

    Any other thing I could try?

  • That's incorrect, you need to set that header on the server, not the client. The manual entry should have explained that.

  • I've done that on server side as well with no success.

    Bellow my php file.

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