Web Share

Tags
webapiwebapp
Created
Feb 17, 2019 10:44 AM

File Web Share Target:

https://paul.kinlan.me/file-web-share-target/

使用 url 来接收共享的文本

使用 service worker(HTTP) 来接收共享的文件

// 都是打开 action 页面

// 将文件发送给 web page
const data = await event.request.formData();
const client = await self.clients.get(event.resultingClientId || event.clientId);
const file = data.get('file');

client.postMessage({ file, action: 'load-image' });

Web Share File:https://wicg.github.io/web-share/level-2/#sharedata-dictionary

SuperMade with Super