How can I view a website running in localhost on m

2019-02-12 17:40发布

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. :)

2条回答
该账号已被封号
2楼-- · 2019-02-12 18:26

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.

查看更多
放我归山
3楼-- · 2019-02-12 18:27

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

查看更多
登录 后发表回答