IOS Safari - How to download or display a pdf

邮差的信 提交于 2020-01-24 20:12:19

问题


just a simple example, I tried using window.open

    var save = 'test'
    var blob = new Blob([save], {
        type: "application/pdf;charset=utf-8"
    });
    var fileURL = URL.createObjectURL(blob);
    window.open(fileURL);

I also tried using FileSaver.js

    var save = 'test'
    var blob = new Blob([save], {
        type: "application/pdf;charset=utf-8"
    });
    saveAs(blob, filename);

Assume the blob contains valid pdf content. It seems to work in all other browsers (including OSX safari) by downloading a pdf file.

However in both cases, it seems to open a new tab that looks like this

I want to be able to do something like this where the pdf would open in a new page

来源:https://stackoverflow.com/questions/57512011/ios-safari-how-to-download-or-display-a-pdf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!