From 7626171b05118449949e18f9b52503047d04e666 Mon Sep 17 00:00:00 2001
From: Eric Willigers
shared. If the ShareData contains no information for a given member,
the query parameter is omitted.
+ A share target might only be interested in a subset of the ShareData + members. +
++{ + "name": "Bookmark", + "share_target": { + "action": "bookmark.html", + "method": "POST", + "enctype": "multipart/form-data", + "params": { + "url": "link" + } + } +} ++
+ The shared information might be read by a service worker. +
++self.addEventListener('fetch', event => { + if (event.request.method !== 'POST') { + event.respondWith(fetch(event.request)); + return; + } + + event.respondWith((async () => { + const formData = await event.request.formData(); + const link = formData.get('link') || ''; + return new Response('Shared link: ' + link); + })()); +}); +
How the handler deals with the shared data is at the handler's discretion, and will generally depend on the type of app. Here are some @@ -325,6 +359,12 @@
+ A use case for GET
requests is when the share target
+ drafts a message for subsequent user approval. If the share target
+ performs a side-effect without any user interaction,
+ POST
requests should be used.
+
The enctype member specifies how the share data is encoded
in the body of a POST
request. It is ignored when