Skip to content

Commit 9042cd1

Browse files
committed
Removed navigator.canShare.
Resolves #5.
1 parent 8d9e049 commit 9042cd1

File tree

2 files changed

+7
-25
lines changed

2 files changed

+7
-25
lines changed

docs/explainer.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,13 @@ shareButton.addEventListener('click', () => {
5151
});
5252
```
5353

54-
You can also test in advance whether there are any installed apps or services
55-
that support sharing (so you can not show the button if you know it won't work):
54+
Developers should be aware that not all user agents will provide
55+
`navigator.share` (sometimes intentionally; for instance, a browser may not
56+
provide it when running on a platform that has no share support). Feature
57+
detection can be used to avoid showing a non-functioning button on a web page:
5658

5759
```js
58-
if (!navigator.canShare())
60+
if (navigator.share === undefined)
5961
shareButton.hidden = true;
6062
```
6163

docs/interface.md

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -66,28 +66,8 @@ modes, but not learn the identity of the chosen application):
6666
* The data could not be delivered to the target app (e.g., the chosen app could
6767
not be launched), or the target app explicitly rejected the share event.
6868

69-
## navigator.canShare
70-
71-
`navigator` also provides a method for determining whether there are any
72-
applications that can handle sharing:
73-
74-
```WebIDL
75-
partial interface Navigator {
76-
boolean canShare();
77-
};
78-
```
79-
80-
Returns `true` if there are one or more applications that could handle a share
81-
event (i.e., if `share` was called, would any applications be presented to the
82-
user?). May give false positives, but not false negatives (on some systems, it
83-
may not be possible to determine in advance whether any native applications
84-
support sharing, in which case `canShare` should return `true`; `false` means
85-
that `share` will definitely fail). This can be used by websites to hide or
86-
disable the sharing UI, to avoid presenting a button that just fails when users
87-
press it.
88-
89-
**TODO(mgiuca)**: This may have to be asynchronous, so that the implementation
90-
can query the file system without blocking.
69+
The `navigator.share` method should be `undefined` if the user agent does not
70+
support any share targets.
9171

9272
## Share handlers
9373

0 commit comments

Comments
 (0)