8

I am working on a Mobile website using jquery mobile and would like to test it using my android Phone browser.

My Windows 7 machine and android phone are on the same wireless network.

I normally access the mobile site from my machine: "http://localhost/index.php/doctor"

I tried accessing it using the wireless network IP address from my mobile: "http://192.168.1.3/index.php/doctor"

but, I get web page not available error.

How do I access localhost from my android phone?!

Ibrahim.Mohamed
  • 93
  • 1
  • 2
  • 6
  • What do the logs on the web server say? (Also - localhost means "this machine that I'm on right now, so when you're on your Android it's the android that's your localhost. This confuses the issue a little.) – Jenny D Jul 09 '12 at 18:54
  • I don't know what you mean? localhost here refers to my pc and I want to connect to that localhost using my mobile phone which is on the same wireless network as my pc. hope that made it clear! – Ibrahim.Mohamed Jul 09 '12 at 19:01
  • When you say that is the IP address of your wireless network, what do you mean? You need the network IP of your windows machine, if that is the IP of your router, that won't work. You should be able to find this out by typing ipconfig /all at a command prompt. It is also worth checking your network/firewall rules on your pc to check it's allowing traffic in. I connect my phone in this way to my laptop when testing, so you definitely can make it work. – Rob Trickey Jul 09 '12 at 19:03
  • I mean "IPv4 Address: 192.168.1.3" !! and how can i check the network/firewall rules on my pc? – Ibrahim.Mohamed Jul 09 '12 at 19:05
  • 3
    I mean that localhost for a computer is the same as the word "myself" for a human. When I say "myself", I mean Jenny D. When you say "me", you mean Ibrahim. When your phone says localhost, it means the phone. When your windows machine says localhost, it means the windows machine. – Jenny D Jul 09 '12 at 19:10
  • In any case, this isn't a programming question and would be better placed at e.g. http://superuser.com/ – Jenny D Jul 09 '12 at 19:11
  • @JennyD "localhost" here refers to my pc! – Ibrahim.Mohamed Jul 09 '12 at 19:12
  • @Ibrahim.Mohamed how are we supposed to know what firewall you're using? As for the most obvious setting, check whether your WiFi is set as a public network in the Win 7 network manager. It shouldn't be if you want to use the computer as a server. If it is public, switch it to home/workplace. – toniedzwiedz Jul 09 '12 at 19:31
  • @Tom the wireless network is defined as a Home network and still I can't connect? and I'm using the ordinary windows firewall – Ibrahim.Mohamed Jul 09 '12 at 20:27
  • @Ibrahim.Mohamed try disabling the firewall to see if it's the root of your problem. If it doesn't help, double check you IP addresses, maybe specify the port. The JQuery tag is irrelevant, you'd be better off replacing it with the tag for your server. – toniedzwiedz Jul 09 '12 at 20:36
  • @Tom when I disabled my firewall it worked perfectly! do you have any idea how can I set the rules for the firewall? thank you, – Ibrahim.Mohamed Jul 09 '12 at 21:43
  • @Ibrahim.Mohamed start with reading this forum thread: http://www.techtalkz.com/windows-7/515977-how-configure-windows-firewall-windows-7-a.html The tools you need are mentioned there. – toniedzwiedz Jul 09 '12 at 21:49

1 Answers1

9

192.168.1.3 is the local network address. What you need to do, is get the external IP address, and put that into the phones URL. You can do this by going into the command line and typing ipconfig, this should give you all your machines IP addresses, along with the external IP for your local webserver. I doubt this has anything to do with your firewall. More than likely, you just need to find the correct IP address for your local webserver.

Hope this helps.

BlackHatSamurai
  • 23,275
  • 22
  • 95
  • 156