4

I want a step by step explanation how to setup a localhost with live reload and so i can access that localhost on another laptop. Basically my goal is to do web development on one laptop an see the results on another laptop with live reload (IF that is possible). I'm a COMPLETE NOOB in this kind of stuff so please try to make it as clear as possible. I did search it up but there is no much to it and im really confused what to do, it would be really helpful if someone could make a step by step guide that i can follow that would be awesome! Thank you!

PS: My main laptop is windows 10 and second laptop is windows 7.

leonheess
  • 16,068
  • 14
  • 77
  • 112

3 Answers3

4

This is an old question but it ranks in Google and has no sufficient (imo b/c live-reload not addressed) up-to-date answer so I figured I could give my two cents.

What you are looking for is Browsersync. You need the javascript runtime Node.js to use it but that is something you most likely have installed anyway.

Run npm install -g browser-sync in your shell to install the Browsersync-module globally (-g) on your system and browser-sync start --server --files . to start the server in the current directory (or replace . with path to different dir). This server can easily be accessed by a different device on your network via the IP of your host system. For more details see @Joundills answer.

For more info please see https://browsersync.io.

leonheess
  • 16,068
  • 14
  • 77
  • 112
0

Provided you have a web server running on your computer, and you want to open it on a different computer on the same local network, it shouldn't be too hard.

Just open up command prompt/terminal and type in

Windows: ipconfig

Mac/Linux: ifconfig

And enter the ip address returned in your browser on the laptop.

Joundill
  • 6,828
  • 12
  • 36
  • 50
  • ok on my main laptop i went to ipconfig and found my ip address then i went to my second laptop and i just enter the ip address in the search bar on my browser? –  Jul 24 '16 at 23:26
  • Yeah, that should do it (assuming there aren't any firewalls or anything in the way) It's also worth noting that if you leave your local network (i.e. you're on a different wifi), you'll have trouble trying to connect, as you need to set up your router to correctly handle web connections. – Joundill Jul 24 '16 at 23:29
  • After i entered my ip address i got the following "Forbidden You don't have permission to access / on this server" –  Jul 25 '16 at 00:55
  • I'm assuming you're using WAMP with default settings. This answer from a different question should help. http://stackoverflow.com/a/19132396/6632744 – Joundill Jul 25 '16 at 01:15
  • Yes I'm using WAMP. Thank you! –  Jul 25 '16 at 01:36
-1

I don't think what you want is possible.

If you connect a cable between the laptops you can share the screen from one to the other, but that requires the laptops to be physically connected in the same room.

The whole point of localhost is that it only operates on your local machine. If you want to collaborate with someone else, you have to push your code up to a Github repository, where they can download it and run their own copy. There is no way to make any changes on your machine automatically propagate to theirs, although they can manually fetch any changes you push to the Github repository.

Jeremy E
  • 463
  • 1
  • 7
  • 19
  • That's the reason I'm trying this, i don't have a cable to physically connect my 2 laptops. Maybe there is another way to view my results on another laptop without physically connecting 2 laptops? –  Jul 24 '16 at 23:30
  • Do you have Internet access on both laptops? Like I said, you can set up a Github repository and push and pull code from that, but it will be slow and laborious. – Jeremy E Jul 25 '16 at 00:19
  • Yes i have internet on both laptops. –  Jul 25 '16 at 00:22