Sunday, 3 June 2018

Access Localhost website from mobile

As a developer, I always want to see how my website looks on a mobile device. Although Chrome developer tools allow you to emulate it, you may want to test it on the actual device.

I am using windows so IIS is the web server here, but I believe the concept applies to other OS too.

Follow these steps -

1. Host your website on locall IIS server and make sure it is accesible from the browser on local machine


2. Check the IP address of your windows machine.
  • Go to run and type cmd, right click and run as administrator
  • type ipconfig and not down the IPv4 address
  • This is the IP address of your machine as visible to other devices connected to your wifi network

 3. Bind the website to the IP address of the machine.
  • Open IIS manager and select the website you want to open
  • Click on bindings on the right hand side 
       

  • Open the bindings and select the IP address as noted in step 2 and click ok.
       


4. Connect your mobile to the same wifi network, open a browser and type IP address, you may have to type port number if the website is hosted on a port other than 80.


Enjoy your website on mobile. Post if you face any issues. Good luck!