You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2022/03/13 20:21:28 UTC
[GitHub] [cordova-android] AntoniosKalattas opened a new issue #1407: net::ERR_CONNECTION_REFUSED
AntoniosKalattas opened a new issue #1407:
URL: https://github.com/apache/cordova-android/issues/1407
Error:
POST https://localhost:83/android_app/login.php net::ERR_CONNECTION_REFUSED
HttpRequest @ renderer.js:19
send_data @ renderer.js:32
onclick @ login.html:31
config xml:
```<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloCordova</name>
<description>Sample Apache Cordova App</description>
<author email="dev@cordova.apache.org" href="https://cordova.apache.org">
Apache Cordova Team
</author>
<content src="login.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="*" />
<allow-navigation href="*" /><!-- Not recommended -->
</widget>
```
renderer:
```
let times = -1;
function HttpRequest(method, url, username, password, xhr) {
xhr.onreadystatechange = () => {
if (xhr.readyState == 4 && xhr.status == 200) {
console.log(xhr.responseText);
if (xhr.responseText == "1") {
window.open('main.html', '_self')
} else {
document.getElementById('response').innerHTML = "Username or Password are set wrong";
console.log("error");
}
}
}
xhr.open(method, url, true);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.send('username=' + username + '&password=' + password);
xhr.onload = function() {
console.log("connected to " + url);
}
}
function send_data(what) {
const xhr = new XMLHttpRequest();
let method = 'POST';
if (what == false) {
let url = 'https://localhost:83/android_app/login.php'; //url of the php server(must be https:// (secure) in order to make the connection using cordova app)
let password = document.getElementById('password').value;
let username = document.getElementById('username').value;
HttpRequest(method, url, username, password, xhr);
}
if (what == true) {
let url = 'https://localhost:83/android_app/unlock.php'; //url of the php server(must be https:// (secure) in order to make the connection using cordova app)
times++;
if (times % 2 == 0) {
unlock(method, url, xhr, true);
} else {
unlock(method, url, xhr, false);
}
}
}
function unlock(method, url, xhr, unlock_state) {
xhr.onreadystatechange = () => {
if (xhr.readyState == 4 && xhr.status == 200) {
console.log(xhr.responseText);
}
}
xhr.open(method, url, true);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.send('unlock_state=' + unlock_state)
xhr.onload = function() {
console.log("connected to " + url);
}
}```
How can I fix the above error?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-android] breautek commented on issue #1407: net::ERR_CONNECTION_REFUSED
Posted by GitBox <gi...@apache.org>.
breautek commented on issue #1407:
URL: https://github.com/apache/cordova-android/issues/1407#issuecomment-1066178956
> POST https://localhost:83/android_app/login.php
I don't think this path is correct unless if you're actually running a php server on your android device.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-android] AntoniosKalattas closed issue #1407: net::ERR_CONNECTION_REFUSED
Posted by GitBox <gi...@apache.org>.
AntoniosKalattas closed issue #1407:
URL: https://github.com/apache/cordova-android/issues/1407
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-android] AntoniosKalattas commented on issue #1407: net::ERR_CONNECTION_REFUSED
Posted by GitBox <gi...@apache.org>.
AntoniosKalattas commented on issue #1407:
URL: https://github.com/apache/cordova-android/issues/1407#issuecomment-1066180154
>
yeah you are right. I forgot that I am using an emulator and not actually running it on my pc. thank you
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org