Run Localhost Website on Mobile Phones and other Devices.

Run Localhost Website on Mobile Phones and other Devices.

How to run a locally hosted website on mobile phones and other devices.

Hey folks, Karthik here. If you are a web developer it's important to create mobile-friendly sites. We have a developer tool where we can change screen size and check but somewhere it feels like "man it would be better if I could use my phone directly". I have a solution for you. Using your phone, PC, or any other screen at a time, the changes will be replicated in real-time on all screens. Basic requirements All your devices have to be connected to one wifi network. It's better if you use a privet network or network which you trust.

Now let us see how to do this:

Step 1: Connect to WiFi.

Ensure that all the devices you wish to view your web projects on are connected to the same network.

Step 2: Look for the local IP (Windows - CDM)

Now open the command prompt in your windows pc and type:

ipconfig

Step 3: Look for the local IP (Mac - Terminal).

ipconfig getifaddr en0

Now open Terminal on your mac and type the above code and you can see your local IP address. Look for the IPv4 address.

Step 4: Look for the local IP (Wifi property).

Open the wifi property. Start > Settings > Network & Internet > Wi-Fi Here also you can find the local IP address (IPv4).

Step 5: Run your web project.

Now once we have the local IP it's time to run our web project on localhost. In the below example, we can see that the site is running on localhost:5500, where 5500 is the post number. The Port number can change.

Step 6: Open on other screens.

Now open your mobile or any other screen, connect to the same WiFi network, open your browser and type Local IP followed by port number. IPv4:Port Number (00.0.0.0:5500).

Repeat the step in others and you can see your web projects on all screens.

Conclusion

I hope this article helped you understand how to view your local host site on mobile phones and other devices. Please let us know if there are any questions or suggestions in the comment below!