Ajax request not working when APK uploaded to phone

I tried to use the existing AJAX example of APPstudio, it works when i run it in google chrome browser, but when i made it a native APP with phonegap and upload it to phone it did not work.

i am using APPstudio 8.0.4.0

NB: same example works with APPstudio 6.2

is there any suggestions?

Use the Chrome Remote Debugger to see if there are errors on the console. My bet is on a CSP error. Chrome has upped its requirements in this area, so old apps may not work.

https://developer.chrome.com/apps/contentSecurityPolicy

Console of remote debug shows the below:

net::ERR_CLEARTEXT_NOT_PERMITTED

This isn’t an AppStudio issue any more. What did you find when you googled this message?

You probably need to set your Content Security Policy in the html headers and make sure all calls to the server are using https.

Problem solved,

“HTTPS” from server side

contentSecurityPolicy property in AppStudio set to:
default-src * gap://ready file:; style-src ‘self’ ‘unsafe-inline’ *; script-src ‘self’ ‘unsafe-inline’ ‘unsafe-eval’ *

Thank you PPetree

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.