- Put
poll.php
somewhere on your server - Include
poll.js
on your web page, anywhere after jQuery. Update the poll interval if you want, and update the URL on line 18 to point to yourpoll.php
file
Viewers will start polling every 500ms (the default I set in poll.js) for updates. If an update is found, the page will refresh.
Admins can make a request to poll.js from directly in their browser (weebcrew.com/poll.php, if that was the path). They need to pass a GET
parameter that matches the password defined in the file. If it matches, it will trigger an update to the timestamp file (filename defined in poll.php
, and can be changed to anything). A request with the password would look like http://weebcrew.com/poll.php?password=YOUR_PASS_HERE
. When users of the site start polling, they'll get this file and compare it to their LOAD_TIME. If the file has an updated time from after they loaded the page, it will trigger a refresh.