Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

access localhost from mobile phone [closed]

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?!

like image 713
Ibrahim.Mohamed Avatar asked Jul 09 '12 18:07

Ibrahim.Mohamed


People also ask

Can I access localhost from another device?

You can access your host machine with the IP address "10.0. 2.2". This has been designed in this way by the Android team. So your webserver can perfectly run at localhost and from your Android app you can access it via "http://10.0.2.2:8080".

How can I access localhost from anywhere?

You are accesing localhost , meaning you have a web server running on your machine. To access it from Internet, you need to assign a public IP address to your machine. Then you can access http://<public_ip>:<port>/ . Port number is normally 80.


1 Answers

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.

like image 159
BlackHatSamurai Avatar answered Oct 25 '22 13:10

BlackHatSamurai