tsgsOFFICIAL
tsgsOFFICIAL

Reputation: 59

How to make xampp automatically update the localhost

I honestly don't have a clue what to put here... I have searched all over the web and can't seem to find anything useful :(

I am looking to make a website, but then I would like it to update each time I write something in the notepad (or at least when I save it) so I don't have to manually press F5 in my browser each time.

Does anyone know how to do so?

Upvotes: 3

Views: 12932

Answers (4)

Abey Bruck
Abey Bruck

Reputation: 635

here is a free solution for you you need to:

  1. First install nodejs from nodejs official website,
  2. Then go to your windows command prompt and install browser-sync by writing the following code npm install -g browser-sync, where npm is node js package manager, -g is for global
  3. Then you open the folder you want browser-sync to follow refresh updates in your terminal or command prompt and write the following code browser-sync start --server --files <files which browser-sync wants to follow and refresh for you> some files like *.html *.css css/*.css *.js dont put commas in between

one thing you need to remember is that you need to write the last command every time you want browser-sync

happy codding :)

Upvotes: 2

Mohammad Ayoub Khan
Mohammad Ayoub Khan

Reputation: 2970

Prepros solved my problem. PrePros

  • Open PHP project folder in Prepros
  • Goto Server options and Select External Server
  • Check Use External Server option and paste the Xampp Project Url.

    How to make xampp automatically update the localhost :)

Upvotes: 2

Nico Bleiler
Nico Bleiler

Reputation: 493

This is going to refresh your page every 10 seconds or whatever amount of milliseconds you input, but that is usually a bad solution, but it is easy and works! Hope this helps, dont forget to remove or disable it when you are done!

setInterval(function(){location.reload(true);}, 10000);

Upvotes: 1

Airmanbzh
Airmanbzh

Reputation: 645

You can build a php script which check if your files are updated then you create an infinite loop or a timed loop on the client side to request this script. If it returns true (updated), you reload your page.

Theoricaly, it works but I discourage you to do it. It will consume a lot of cpu and will not be really usefull...

Upvotes: 0

Related Questions