Having trouble with XMLHttpRequest in Android WebView browser.
NOTE: I don't know if this post belongs here
I am connecting an IoT device to an Android device over WiFi to provision it and while the provisioning process is under way it won't have internet access through WiFi.
I provisioning is done through a web page hosted by the IoT device. The problem I am having is that I want to send some GET requests to a public API using XMLHttpRequest and I keep getting the error ERR_CONNECTION_REFUSED (I am assuming because it is trying to use my WiFi connection.
Is there any way in JavaScript to force this GET request to use the Cell data connection instead of WiFi?
Posted Nov 3, 2016, 5:58 PM UTC
22
I would be surprised if it is due to the connection type. However to test that theory, I would turn off wifi on the device, then the connection will be forced to use the cell connection. Having said that, there is no way to force the XMLHTTPRequest object to use a particular connection type.
Hmm, thanks for the advice. I think this problem is going to be difficult to solve because I am using Android's "Sign in to Wi-Fi network" functionality which pops up a webpage used to login. Once I turn off WiFi, it closes the page. I'm wondering if this is more of an Android question than a JavaScript question at this point.
Here's the Android app I'm talking about https://imgur.com/U8chl7V