Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Web Share] Add list of usually shareable file types #11023

Merged
merged 6 commits into from
Dec 7, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 51 additions & 1 deletion files/en-us/web/api/navigator/share/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ navigator.share(data)
- `url`: A {{domxref("USVString")}} representing a URL to be shared.
- `text`: A {{domxref("USVString")}} representing text to be shared.
- `title`: A {{domxref("USVString")}} representing a title to be shared. May be ignored by the target.
- `files`: An array of {{domxref("File")}} objects representing files to be shared.
- `files`: An array of {{domxref("File")}} objects representing files to be shared. See [below](#shareable-file-types) for shareable file types.
tomayac marked this conversation as resolved.
Show resolved Hide resolved

### Return value

Expand All @@ -64,6 +64,56 @@ The {{jsxref("Promise")}} may be rejected with one of the following `DOMExceptio
- `DataError`
- : There was a problem starting the share target or transmitting the data.

## Shareable file types

| Category | Extension - `MIME type |
tomayac marked this conversation as resolved.
Show resolved Hide resolved
| ----------- | ------------------------------------------------ |
| Application | |
| | `.pdf` - `application/pdf` (from Chromium 93) |
| Audio | |
| | `.flac` - `audio/flac` |
| | `.m4a` - `audio/x-m4a` |
| | `.mp3` - `audio/mpeg` (also accepts `audio/mp3`) |
| | `.oga` - `audio/ogg` |
| | `.ogg` - `audio/ogg` |
| | `.opus` - `audio/ogg` |
| | `.wav` - `audio/wav` |
| | `.weba` - `audio/webm` |
| Image | |
| | `.bmp` - `image/bmp` |
| | `.gif` - `image/gif` |
| | `.ico` - `image/x-icon` |
| | `.jfif` - `image/jpeg` |
| | `.jpeg` - `image/jpeg` |
| | `.jpg` - `image/jpeg` |
| | `.pjp` - `image/jpeg` |
| | `.pjpeg` - `image/jpeg` |
| | `.png` - `image/png` |
| | `.svg` - `image/svg+xml` |
| | `.svgz` - `image/svg+xml` |
| | `.tif` - `image/tiff` |
| | `.tiff` - `image/tiff` |
| | `.webp` - `image/webp` |
| | `.xbm` - `image/x-xbitmap` |
| Text | |
| | `.css` - `text/css` |
| | `.csv` - `text/csv` |
| | `.ehtml` - `text/html` |
| | `.htm` - `text/html` |
| | `.html` - `text/html` |
| | `.shtm` - `text/html` |
| | `.shtml` - `text/html` |
| | `.text` - `text/plain` |
| | `.txt` - `text/plain` |
| Video | |
| | `.m4v` - `video/mp4` |
| | `.mp4` - `video/mp4` |
| | `.mpeg` - `video/mpeg` |
| | `.mpg` - `video/mpeg` |
| | `.ogm` - `video/ogg` |
| | `.ogv` - `video/ogg` |
| | `.webm` - `video/webm` |

## Examples

The example below shows a button click invoking the Web Share API to share MDN's URL.
Expand Down