Start a new topic
Solved

XMLHttpRequest not getting status and response

Hello,


I am using the sample project together with Flutter but when I change the POIDATA_SERVER to my own the XMLHttpRequest doesn't get the response and the status from the callback.

I have tried to debug with AP.logger but I don't get the message at all.


I have tried the same js code on a plain HTML file and there the response and the status are well received.


Is there any restriction with http calls? Does it have to be only https?


Flutter version: 1.22.6

WikiTube Flutter Plugin: 9.70


Hi Michael,


Are you testing with Android or with iOS?


Thanks,

Eva

Hi Eva,

I am testing with Android currently and I have tested with a free json dummy creator that's over https and it works, so I am definitely sure that the issue is from the plain http.

How we can enable http XMLHttpRequest?

Any option about XMLHttpRequest onver http?

Hello,


As far as I know XMLHttpRequest should work with http links. My guess would be that the issue is related to the way you are handling CORS -> https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS. Please have a look at the link I sent as it may give you an idea of what's going on with your url.


Take into account that this class (XMLHttpRequest) is not part of our SDK but a JS class we are using in our sample app. Feel free to use other approaches that fits your requirements.


Regards,


Aitor.

Hi Aitor,


I don't think that its related with the code, since I have tested exactly the same code on an html script and it received the json response without any issue.

While on the architectWidget is returns an error.


The response header is Access-Control-Allow-Origin: *.


The error that I get is a ProgressEvent (caught on XMLHttpRequest.onerror

Hi the issue is due to flutter and android restrictions.

Following the instructions on this page we can connect to unsecure http api's.


https://flutter.dev/docs/release/breaking-changes/network-policy-ios-android 

Login or Signup to post a comment