Access Localhost from Smartphone with help of VS Code and Live Server

bkanhu

B Kanhu Charan

Posted on January 6, 2022

Access Localhost from Smartphone with help of VS Code and Live Server

Responsive Web design, well I know the developer console is a greater tool for debugging. and it gives you an option to check the responsiveness of your webpage. but checking it on a real device is always better.
So how to do it without too much hassle? The simple answer is with help of VS Code and Extensions called Live Server.

Before proceeding make sure your laptop and mobile device are connected to the same wifi.

For this, you need to install VS Code from here. And Live Server Extensions by Ritwick Dey from here.

After installing open your project folder on VS Code. You can do it by "drag-and-drop" or by navigating to "File > Open Folder".

Then open index.html and right-click on Editor, from the "Explorer Window" choose "Open with Live Server".

vs-code-open-with-live-server.png

Remember the port, on which the live server is running.

live-server-ip-address.png

Now open "Command Prompt" on windows and type ipconfig hit Enter. Check the IP Address.

Now open your favorite browser on your smartphone and on the address bar enter the IP Address of your Computer and port of the local server. after that file name. like http://ip_address:port/filename for example, mine would be: http://196.168.43.14:5500/index.html

live-server-mobile-preview.jpeg

💖 💪 🙅 🚩
bkanhu
B Kanhu Charan

Posted on January 6, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related