在IE 11浏览器中没有显示base64 pdf

时间:2018-03-23 09:21:18

标签: angularjs

同样的base64 pdf正在chrome和mozilla firefox上显示,但它没有在IE浏览器中显示,请让我现在解决它,我的代码如下

var pdf = response.data?response.data.base64:“”;

            var doc = document.createElement("a");
            doc.href ='data:application/octet-stream;base64,' + pdf;
            doc.target = "blank";
            //    doc.download = response.data.fileName?response.data.fileName:"";
            if(response.data.base64){                    //$window.open('data:application/pdf;base64,' + pdf);
            var iframe = "<iframe width='100%' height='100%' src='data:application/pdf;base64,"  + response.data.base64 + "'></iframe>" 
            //var iframe = "<iframe width='100%' height='100%' src='" + response.data.base64 + "'></iframe>"
            var x = window.open();
            x.document.open();
            x.document.write(iframe);
            x.document.title = 'IndiaFIRST';
            x.document.close();
            }

0 个答案:

没有答案