I recently started developing a Website. However, I am having trouble running it on localhost. When I type http://localhost in my web browser.
I recently started developing a Website. However, I am having trouble running it on localhost. When I type http://localhost in my web browser.
css
2
Answers
Follow the steps:
Step 1: open CMD and write
ipconfig
Step 2: Find
ipv4 address
which is look likeIPv4 Address : 192.168.x.x
Step 3: write the address into your mobile phone and in the last add
:PORT
PORT= Write the PORT number on which your website is running it is shown inbrowser url
orlive server
extension invscode
url:
http://192.168.x.x:PORT
Your localhost is the machine the code is running on, it acts like a server, but locally. If you want to access the website on your mobile phone, you need to find your computer’s IP Address. you can get this by opening a command prompt and typing in
ipconfig
and checking for the IPv4 address, there might be two, try either of them. Then make sure your phone and computer are connected to the same network (e.g like let the computer and phone be connected to the same WiFi. Make sure the wifi is not private though) you can then use this IP on your phone, followed by the port number for example192.158.1.38:4000
where4000
is the port number.And from you tag of
css
, I am guessing you want to test responsive code, I can advice you check your browser’s dev tools by right clicking on anywhere on the browser window and clicking inspect, from here, you can toggle between mobile and desktop view, or even choose different mobile devices to see what your website will look like on those deviceslet me know if you need any more assistance. Hope this was helpful 🙂