How to access LocalHost on your mobile device?

📋 Table Of Content
This article is about how to access Localhost on your mobile browsers and view the web site running on your localhost from your mobile in real time.
So, if you are working on a website or an web application and want to view the pages on your mobile, the this article will help you do that easily.
Generally when we develop a website and want to check its responsiveness, we usually open our chrome inspect tools and check the mobile view in our desktop browser itself.
However sometimes we need to check the touch event or other events which is only possible in a real mobile device. So for that accessing Localhost from our mobile device becomes important.
Access Localhost on your mobile browsers.
To access your localhost from your mobile follow the steps below:
Step 1 : Start your application on your local machine first. Once it opens in your browser, you will get the URL as localhost:3000
, now write down the post number which is 3000
in this case.
Step 2 : Open command prompt and type this command ipconfig
and press Enter. You will get lots of information on the screen but we only need the IPv4 address
. IPv4 address looks like 192.164.45.1 .
IPv4 address will different in your PC.
Step 3 : Once you have the Port Number and the IPv4 address.
Open your mobile browser and type IPv4 Address: PORT
. For example: 192.164.45.1:3000
That's it, now you can test your web application on your mobile device in real time.