Viewing Your Websites On Other Devices In Real Time Through Local Host

Viewing Your Websites On Other Devices In Real Time Through Local Host

ยท

2 min read

Have you ever wanted to view your website on your mobile phone, as you are coding with your laptop? if your answer is yes let's dive in.

if you use Vscode with live server extension, the extension creates a server on your system which can be accessed via a particular port, this is similar to Vue "npm run serve" and Django "python manage.py runsever". this port can be accessed on other devices if it's connected on the same network.

if you are using Linux:

  • run sudo ifconfig
  • this gives you info on your device connections
  • check for the interface you are using
  • if its wifi it will be wlan0, USB tethering it will be usb0 and ethernet eth0.
  • Alt Text
  • for example, I am using USB tethering
  • copy the inet, in this case, 192.168.42.107
  • in your mobile browser input the URL
  • inet:port e.g http://192.168.42.107:8000
  • that's all, although some services may require other settings like Django



OG Photo by Mark Wong on Unsplash