Properly Create and Serve PDF Blob via HTML5 File and URL APIs

后端 未结 3 1646
我寻月下人不归
我寻月下人不归 2020-12-02 23:44

Ok, Let\'s say I have document data stored somewhere, let\'s arbitrarily take this pdf.

Issue #1. What I want to do is make an AJAX call to this URL (because I need

3条回答
  •  误落风尘
    2020-12-03 00:04

    var src_url = your url here;
    var contentDisposition = 'AlwaysInline';
    var src_new = src_url.replace(/(ContentDisposition=).*?(&)/, '$1' + contentDisposition + '$2');
    

    By doing this you will be able to view pdf instead of downloading it,

    Header ContentDisposition should be 'AlwaysInline' then only it displays your file instead of downloading it.

提交回复
热议问题