网络共享API级别2 PDF支持 [英] Web-share api level 2 PDF support

查看:84
本文介绍了网络共享API级别2 PDF支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的PWA应用程序使用网络共享级别2.除PDF之外,每种媒体格式都可以正常工作. Web API返回PDF的base64字符串,在客户端,我正在从中创建blob对象.但是当我共享它时,会引发异常:权限被拒绝

I am using web-share level 2 for my PWA app. Every media format is working fine except PDF. Web api is returning base64 string of PDF, At client side, I am creating blob object from it. but when I share it, Throws exception : Permission Denied

 var file = new File(["/9j/4AAQSkZJRgABAQAAAQABAAD...."], 'filename.pdf', { type: 'application/pdf' });

var filesArray = [];

filesArray.push(file);

 navigator['share']({files: filesArray})
        .then(() => console.log('Share was successful.'))
        .catch((error) => console.log('Sharing failed', error));

我没有任何线索.

推荐答案

对于其他可能遇到此问题的人,在

For others who might encounter this problem, this was discussed on https://github.com/w3c/web-share/issues/141 and is a current limitation in Chrome tracked in https://crbug.com/1006055

这篇关于网络共享API级别2 PDF支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆