How to use blobs and createObjectURL in Edge and IE

Viewed 2269

I'm using the following code to load PDFs into a window from an AJAX request:

$('#divEmbedPdf').empty();

var req = new XMLHttpRequest();
req.open('GET', '/api/read/file?p_key=<some key>', true);
req.responseType = 'blob';
req.setRequestHeader('SomeAuthHeader', 'SomeTokenValue');
req.onload = function (event) {
    var fblob = req.response;

    $('<iframe/>', {
        src: window.URL.createObjectURL(fblob),
        frameborder: 0,
        marginheight: 0,
        marginwidth: 0,
        css: {
            position: 'absolute',
            width: '100%',
            height: '100%'
        }
    }).appendTo($('#divEmbedPdf'));
}
req.send();

This works fine in Chrome and FF, but Edge is throwing the following error:

SEC7134: Resource 'blob:C88E2211-80B6-4933-B5E1-0E8DE3665368' not allowed to load.

Is there a way to make this work with Edge? I don't want to open a new window, because this runs within a popup that I want to look persistent without opening and closing. As you will note I send a custom header in the request for authentication so I cannot just make an iframe and set the src attribute to a path.

1 Answers

I guess by now you have your answer

Thank you for providing this information about the issue. We previously confirmed the problem, and have published a solution on a new build of Edge. We are resolving this issue as a duplicate of an existing internal bug report. We look forward to additional feedback you may have on how we can improve Microsoft Edge.

Related