3

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?

tsgsOFFICIAL
  • 59
  • 2
  • 11

4 Answers4

2

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

Abey Bruck
  • 532
  • 5
  • 7
1

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);
Nico Bleiler
  • 475
  • 4
  • 14
1

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 :)
Mohammad Ayoub Khan
  • 2,422
  • 19
  • 24
0

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

Airmanbzh
  • 615
  • 1
  • 5
  • 11