Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello. I'm trying to connect my app to my node.js server. If I run this anywhere but within a compiled android app, it works fine. Also, if I substitute the ip.address with an myfile.html local reference, it works fine. Am I doing something wrong? Am I able to open an ip address in the url? Please help.
Here's html file:

<html>
<head>

<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">

<script type="text/javascript">
function load()
{
window.location.href = "http://192.168.0.1:3000";
}
</script>
</head>

<body onload="load()">
<h1>Connecting to Server...</h1>
</body>
</html>
Posted
Updated 30-Dec-15 18:38pm
v2
Comments
Sergey Alexandrovich Kryukov 31-Dec-15 0:32am    
Literally, "http://ip.address"? :-)
—SA
Member 12237207 31-Dec-15 0:35am    
No haha, my ip address 192.168.0.1:3000 connects to my node.js server.
Sergey Alexandrovich Kryukov 31-Dec-15 0:39am    
Is your client on the same LAN as node.js server? This is not Internet address...
Does anything work if you simply enter this address in browser address line? I guess, not.
—SA
Member 12237207 31-Dec-15 0:42am    
Yes it is LAN. It is not a public IP. Through browsers on same router can easily access server with putting the ip address:3000 in url. My android phone works too using a browser, but if I try compiling into an App and running it on the phone, it gets stuck on "Connecting to Server...". I have been at it for 3 days trying everything ):
José Amílcar Casimiro 31-Dec-15 7:01am    
Does your phone support javascript?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900