【问题标题】:Web-share api level 2 PDF supportWeb-share api 2 级 PDF 支持
【发布时间】:2020-01-17 05:13:32
【问题描述】:

我正在为我的 PWA 应用使用网络共享级别 2。除 PDF 外,每种媒体格式都可以正常工作。 Web api 正在返回 PDF 的 base64 字符串,在客户端,我正在从中创建 blob 对象。但是当我分享它时,抛出异常: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));

我不知道发生了什么。

【问题讨论】:

标签: javascript google-chrome progressive-web-apps w3c


【解决方案1】:

对于可能遇到此问题的其他人,这已在 https://github.com/w3c/web-share/issues/141 上进行了讨论,并且是在 https://crbug.com/1006055 中跟踪的 Chrome 的当前限制

【讨论】:

    猜你喜欢
    • 2014-01-14
    • 1970-01-01
    • 2015-10-05
    • 2014-03-25
    • 1970-01-01
    • 2012-11-15
    • 1970-01-01
    • 1970-01-01
    • 2020-04-10
    相关资源
    最近更新 更多