| <html xmlns="http://www.w3.org/1999/xhtml"> | |
| <head> | |
| <title>Massive Memory Leak</title> | |
| <script> | |
| <![CDATA[ | |
| function loadVideo (videoURI) { | |
| var xhr = new XMLHttpRequest(); | |
| xhr.open('GET', videoURI, true); | |
| xhr.onreadystatechange = function (xhrEvent) { | |
| if (xhr.readyState == 3) { | |
| var currentLength = xhr.responseText.length; | |
| var totalLength = parseInt(xhr.getResponseHeader('Content-Length'), 10); | |
| print((Math.round((currentLength / totalLength) * 10000) / 100) + '%'); | |
| } | |
| else if (xhr.readyState == 4) { | |
| if (xhr.status == 200) { | |
| alert('done loading'); | |
| alert(xhr.responseText.length); | |
| } | |
| else { | |
| alert('NOK'); | |
| } | |
| } | |
| }; | |
| xhr.send(null); | |
| } | |
| function print (message) { | |
| document.getElementById('outlet').textContent = message; | |
| } | |
| ]]> | |
| </script> | |
| </head> | |
| <body> | |
| <a onclick="loadVideo('http://streamos.atlrec.com/download/atlantic/bjork/video/bjork_itunes1.m4v');">do it!</a> | |
| <p id="outlet" /> | |
| </body> | |
| </html> |