How can I access my localhost through Android phone? How can I access my localhost through Android phone? android android

How can I access my localhost through Android phone?


its very simple ,- GOTO command line (Window + R [type cmd]) - type ipconfig , that will show the current IP address of your PC - write taht IP address on your Android Phone's browser with :80 e.g (http://192.168.x.x:80)

Done

localhost will appear on your Phone


  1. Retrieve your IP address:
    In Ubuntu: type ifconfig in terminal
    In Windows: type ipconfig in cmd`
  2. Disable your Firewall
    In Ubuntu: type sudo ufw disable in terminal
    In Windows: Go to "Control Panel> System and Security> Windows Firewall" and turn it off.
  3. Insert retrieved IP address into your phone browser.
    (Your XAMPP local server must be running)
    Well done!


USB doesn't provide network to mobile device. If it's connected to your wifi, then hit your laptop address provided by the router. If it's connected to your mobile network, then first find out your router external IP address, then forward some port to that 10.0.2.2:portno and finally you'll be able to see that server from your device.

source: https://stackoverflow.com/a/4779992/1932105

or this:

It is very simple

Turn on Wifi Hotspot of your android phone and connect your Laptop with your phone.

Start your server at localhost (I am using wamp server)

Now open command prompt and enter ipconfig command you will get following things

Wireless LAN adapter Wireless Network Connection:  Connection-specific DNS Suffix  . :  Link-local IPv6 Address . . . . . : fe80::80bc:e378:19ab:e448%11  IPv4 Address. . . . . . . . . . . : 192.168.43.76  Subnet Mask . . . . . . . . . . . : 255.255.255.0  Default Gateway . . . . . . . . . : 192.168.43.1

Copy this 192.168.43.76 in your mobile browser.

Note : Please set you network as "Home Network".

source: https://stackoverflow.com/a/15864222/1932105

please use the search next time.