A live JPEG or MJPEG hit counter that you can embed in your website.
View a live demo at: https://hits.serv.rs/
- Each request serves an image that displays the number of requests made to that specific image.
- You can choose either a
live
orstatic
image. Thelive
image is served asmjpeg
, a format which can be updated continuously after the page load is complete. - The image can be customized by changing the default font, and colors.
You can install the source for this server by downloading this repository, and running npm install
.
Each instance of the counter you embed on a website should have a unique ID. It can be anything (up to 20 characters) -- we don't pick that for you. It could be something programmatic like md5(location.hostname)
a GUID, numeral Id (12345
), or any other url-safe string you like (like foo%20bar
).
<img src="http://localhost:5000/live/12345" height="40" />
You can customize the widget by passing parameters, like:
<img src="http://localhost:5000/live/12345?font=Futura&color=black&bg=white" height="40" />
If you don't want to use a live image, you can use a static one, like:
<img src="http://localhost:5000/static/12345" height="40" />
Inspired by these blog posts:
https://underjord.io/live-server-push-without-js.html
--