Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I view a website running in localhost on machine in chrome browser?

I am working on a rails web app, currently focusing on the mobile design and would like to view html screens I have developed in the mobile chrome browser on my Galaxy Nexus (running Jelly Bean).

On my MacBook Pro I am able, obviously, to run a local server and view the site on my machine via LocalHost:3000 url. Would it be possible to complete some network configuration on my phone/macbook pro to view the Local Host site on my phone when its running on my machine? Could Chrome Dev Tools be leveraged in anyway?

e.g.

https://developers.google.com/chrome/mobile/docs/debugging

+5 cool points for whoever answers this question. :)

like image 299
chapandscholar Avatar asked Aug 07 '12 15:08

chapandscholar


People also ask

How do I access localhost in Chrome?

Go to Chrome setting > Privacy and Settings > See all the cookies and site data, search for localhost and delete it. Then refresh your site it will be working.

How do I access my localhost website?

Usually, you can access the localhost of any computer through the loopback address 127.0. 0.1. By default, this IP address references a server running on the current device. In other words, when your computer requests the IP address 127.0.

How can I access my localhost from another computer over the Internet?

http://localtunnel.me. http://localhost.run.


2 Answers

For anyone using Rails 4.2, trying to access via ip address will probably fail due to a change in Rails.

Start the server using rails server -b 0.0.0.0 would allow you to access your localhost from your phone like before.

like image 117
lulalala Avatar answered Nov 05 '22 11:11

lulalala


On your mac go open your network preferences (click the wifi signal at the top). Find the ip address of the network you are currently connected to. In the browser of your phone, type in that ip address and append :3000 to the end of it

like image 25
Kyle C Avatar answered Nov 05 '22 13:11

Kyle C