live.js sending consecutive HEAD requests to the server and if there is a change in the html, css or js file, live.js refreshing the data.
It's very simple Just link the file to the html file
<script type="text/javascript" src="live.js">
It works well if the files on a server but if I'm working on a local computer with notepad It does not work.
Does anyone know why and how to fix it?
Approach 1: One can auto refresh the webpage using the meta tag within the head element of your HTML using the http-equiv property. It is an inbuilt property with HTML 5. One can further add the time period of the refresh using the content attribute within the Meta tag.
Reloading is triggered whenever changes are saved in the IDE, either automatically or using Press Ctrl + S on Windows/Linux, ⌘ + S on macOS, or when changes are made to a file externally.
In general, live.js
does not support the file protocol. However, there is a very easy work-around (suggested by @MarcelValdezOrozco in a comment to this answer):
If you have Python installed, you can start a local webserver simply by running
$ python -m SimpleHTTPServer
Run it in the same directory as your HTML file. By default, the server will list the content of the directory. Navigate to your HTML. Now auto-reloading using live.js
should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With