- From: Eric Willigers <notifications@github.com>
- Date: Tue, 22 May 2018 20:23:27 -0700
- To: w3ctag/design-reviews <design-reviews@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3ctag/design-reviews/issues/221/391208315@github.com>
A demo for sharing small HTML and CSS files is [live](https://web-share-target-demo-one-dot-petrogale-purpureicollis.appspot.com/) with [source](https://github.com/ewilligers/web-share-target-demo).
The [sharing code](https://github.com/ewilligers/web-share-target-demo/blob/master/share.html) uses the traditional `navigator.share()` API, except that we add a "files" member to the dictionary. This contains a `FileList` (or any `File` sequence).
The [target's manifest](https://github.com/ewilligers/web-share-target-demo/blob/master/manifest.webmanifest) specifies that it would like a POST request, and specifies the field names and accepted MIME types:
```
{
"name": "WebShareTargetDemo",
"share_target": {
"action": "share-target-destination.html",
"method": "POST",
"params": {
"title": "received_title",
"text": "received_text",
"url": "received_url",
"files": [
{
"name": "received_html_files",
"accept": "text/html"
},
{
"name": "received_css_files",
"accept": "text/css"
}
]
}
}
}
```
The form POST can be handled client-side (by a service worker) or server-side.
For the initial version of Web Share Target, we will omit support for file sharing or POST requests. A typical manifest would be
```
{
"name": "WebShareTargetDemo",
"share_target": {
"action": "share-target-destination.html",
"params": {
"title": "received_title",
"text": "received_text",
"url": "received_url"
}
}
}
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/221#issuecomment-391208315
Received on Wednesday, 23 May 2018 03:23:52 UTC