1 <html xmlns="http://www.w3.org/1999/xhtml">
4 <title>Massive Memory Leak</title>
8 function loadVideo (videoURI) {
9 var xhr = new XMLHttpRequest();
10 xhr.open('GET', videoURI, true);
11 xhr.onreadystatechange = function (xhrEvent) {
12 if (xhr.readyState == 3) {
13 var currentLength = xhr.responseText.length;
14 var totalLength = parseInt(xhr.getResponseHeader('Content-Length'), 10);
15 print((Math.round((currentLength / totalLength) * 10000) / 100) + '%');
17 else if (xhr.readyState == 4) {
18 if (xhr.status == 200) {
19 alert('done loading');
20 alert(xhr.responseText.length);
30 function print (message) {
31 document.getElementById('outlet').textContent = message;
39 <a onclick="loadVideo('http://streamos.atlrec.com/download/atlantic/bjork/video/bjork_itunes1.m4v');">do it!</a>