我正在为我的 PWA 应用程序使用网络共享级别 2。除了 PDF 之外,所有媒体格式都可以正常工作。 Web api 返回 PDF 的 base64 字符串,在客户端,我正在从中创建 blob 对象。但是当我分享它时,抛出异常:权限被拒绝
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));
我不知道发生了什么事。
对于其他可能遇到此问题的人,此问题已在https://github.com/w3c/web-share/issues/141 https://github.com/w3c/web-share/issues/141这是 Chrome 中的当前限制https://crbug.com/1006055 https://crbug.com/1006055
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)