Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <script>
- var myCamTimer, myCamTimeout, dial1;
- function refreshCamera() {
- var b = new Date;
- var addr = "https://pa511cams.ilchost.com/cameras/d6/CAM-06-470.jpg?nocache="
- a = document.getElementById("myCam");
- var xhr = new XMLHttpRequest();
- xhr.responseType = 'blob'; //so you can access the response like a normal URL
- xhr.onreadystatechange = function () {
- if (xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
- a.src = URL.createObjectURL(xhr.response); //create <img> with src set to the blob
- }
- };
- xhr.open('GET', addr + b.getTime(), true);
- xhr.setRequestHeader('Referer', 'https://www.511pa.com/CameraListing.aspx');
- xhr.send();
- //a.src = a.src.substring(0, a.src.indexOf("nocache=")) + "nocache=" + b.getTime()
- }
- function startCamRefresh() {
- clearInterval(myCamTimer);
- clearTimeout(myCamTimeout);
- myCamTimer = setInterval(function() {
- refreshCamera()
- }, 5e3);
- myCamTimeout = setTimeout(function() {
- stopCamRefresh()
- }, 65e3);
- try {
- document.getElementById("camRefLink").style.visibility = "hidden";
- } catch (a) {}
- }
- function stopCamRefresh() {
- clearInterval(myCamTimer);
- clearTimeout(myCamTimeout);
- try {
- document.getElementById("camRefLink").style.visibility = "visible";
- } catch (a) {}
- }
- </script>
- </head>
- <body onload=startCamRefresh()>
- <img id="myCam" style="height:240px;width:352px;"
- title="cam image - US 1 NB at Old Lincoln Highway"
- src="https://pa511cams.ilchost.com/cameras/d6/CAM-06-470.jpg?nocache=1539188740869">
- <div id="camRefLink" style="visibility:hidden">Stream Timed Out</div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement