Handling binary data from ajax request

Handling binary data from ajax request

I receive binary data from an ajax request. I like to put the content in a new window or an iframe in an ovelay. I like the iframe overlay idea. I tried to use WebKitBlobBuilder but it is not working.
 
Here are my limitations:
 
1. I can't pass the URL to windows.open as I need to set request headers.
2. I can get different content type image, text etc.
3. I don't want the user to see the header information as it has security credentials. 
 
Ajax Code:
 
 

$.ajax({

type: "GET",

headers: {

"Authorization": header,

},

url: URL,

cache: false,

data: { },

complete: function(xhr, status) {

alert('hi');

var bb = new window.WebKitBlobBuilder();

alert('hi');

// Append the binary data to the blob

bb.append(xhr.responseText);

var blobURL = window.webkitURL.createObjectURL(bb.getBlob('image/jpeg '));

window.open(blobURL);

}

});

}

 
Any ideas?