Displaying Blob PDF in Edge/IE11
A cross-browser workaround to have an iframe of PDF.js load a blob of a PDF via the iframe URI.
An example of a standard usage case blob URI:
/viewer.html?file=blob:19B579EA-5217-41C6-96E4-5D8DF5A5C70B
File viewer.js:
within function webViewerOpenFileViaURL:
change line from:
if (file && file.lastIndexOf('file:', 0) === 0) {
to:
if (file && file.lastIndexOf('file:', 0) === 0 || file && file.lastIndexOf('blob:', 0) === 0) {
And to further stop the viewer from breaking when the "origin" is behaving in an IE 11/Edge manner:
within function validateFileURL:
change line from:
if (fileOrigin !== viewerOrigin) {
to:
if (fileOrigin != "null" && fileOrigin !== viewerOrigin) {
Now FF, Chrome, IE 11, and Edge all display the PDF in a viewer in the iframe passed via standard blob URI in the URL.