Tuesday, January 15, 2013

XMLHttpRequest simple example

  var xhr = new XMLHttpRequest();  
      xhr.open('GET', 'https://supersweetdomainbutnotcspfriendly.com/image.png', true);  
      xhr.responseType = 'blob';  
      xhr.onload = function(e) {  
       var img = document.createElement('img');  
       img.src = window.webkitURL.createObjectURL(this.response);  
      };  
      xhr.send();  

No comments:

Post a Comment