diff --git a/index.html b/index.html index db57754..3b6227a 100644 --- a/index.html +++ b/index.html @@ -65,22 +65,22 @@
- Note that a url
of ''
- refers to the current page URL, just as it would in a link. Any other
- absolute or relative URL can also be used.
+
+ Note that a url of ''
refers to the current page
+ URL, just as it would in a link. Any other absolute or relative URL can
+ also be used.
- In response to this call to navigator.share
, the
- user agent would display a picker or chooser dialog, allowing the user
- to select a target to share this title and the page URL to.
+ In response to this call to navigator.share(), the user agent
+ would display a picker or chooser dialog, allowing the user to select a
+ target to share this title and the page URL to.
Navigator
interface
share
will
- throw a TypeError
if called
- with no arguments. WebIDL share() will throw a TypeError if
+ called with no arguments. WebIDL mandates that it be optional because the
dictionary members are all optional. See WebIDL Issue #130.
- User agents that do not support sharing SHOULD NOT expose share
on the
- Navigator
interface.
+ User agents that do not support sharing SHOULD NOT expose
+ share() on the Navigator interface.
share
is present, there is a
- reasonable expectation that it will work and present the user with at
- least one share target. Clients can use the presence or
- absence of this method to determine whether to show UI that triggers
- its use.
+ share() is present, there is a reasonable expectation that it
+ will work and present the user with at least one share target.
+ Clients can use the presence or absence of this method to determine
+ whether to show UI that triggers its use.
share
method
+ share() method
- When the share method is called with argument + When the share() method is called with argument data, run the following steps:
-TypeError
, and
- abort these steps.
+ TypeError
,
- and abort these steps.
+ TypeError, and abort these steps.
NotAllowedError
, and
- abort these steps.
+ "!promises-guide#reject-promise">reject p with a
+ "NotAllowedError" DOMException, and abort these
+ steps.
AbortError
, and abort
- these steps.
+ p with an "AbortError" DOMException, and
+ abort these steps.
AbortError
, and abort
- these steps.
+ p with an "AbortError" DOMException, and
+ abort these steps.
AbortError
, and abort
- these steps.
+ p with an "AbortError" DOMException, and
+ abort these steps.
share
always shows some form of
- UI, to give the user a choice of application and get their approval
- to invoke and send data to a potentially native application (which
- carries a security risk). For this reason, user agents are
- prohibited from showing any kind of "always use this target in the
- future" option, or bypassing the UI if there is only a single share
- target.
+ share() always shows some form of UI, to give the user a
+ choice of application and get their approval to invoke and send
+ data to a potentially native application (which carries a security
+ risk). For this reason, user agents are prohibited from showing any
+ kind of "always use this target in the future" option, or bypassing
+ the UI if there is only a single share target.
ShareData
dictionary
The ShareData dictionary consists of several optional - fields: + members:
-Each share target MAY be made conditionally available depending on the - ShareData payload delivered to the share - method. + ShareData payload delivered to the share() method.
+
Mapping the ShareData to the share target (or operating system)'s native format can be tricky as some platforms will not have an equivalent set of fields. For example, if the target has a "text" field but not a "URL" field, one solution is to concatenate both the - text and url fields of - ShareData and pass the result in the "text" field of the - target. + text and url fields of ShareData and pass the + result in the "text" field of the target.
+ The following are defined in [[!WEBIDL]]: +
+DOMException
+ AbortError
+ NotAllowedError
+
+ TypeError
+ is defined by [[!ECMASCRIPT]].
+
navigator.share
, because this information could be
- used for fingerprinting, as well as leaking details about the user's
- device.
+ are installed, or which app was chosen from navigator.share(),
+ because this information could be used for fingerprinting, as well as
+ leaking details about the user's device.
navigator.share
- is rejected. Even distinguishing between the case where no targets are
+ revealed in the error message when navigator.share() is
+ rejected. Even distinguishing between the case where no targets are
available and user cancellation could reveal information about which
apps are installed on the user's device.
navigator.share
- presents the user with a dialog asking them to select a target
- application (even if there is only one possible target). This surface
- serves as a security confirmation, ensuring that websites cannot
- silently send data to native applications.
+ navigator.share
is navigator.share() is available only in secure
contexts (such as https://
schemes).
navigator.share
from a Use of navigator.share() from a private browsing mode
might leak private data to a third-party application that does not
respect the user's privacy setting. User agents could present
@@ -390,11 +407,11 @@ navigator.share
might be
- used to exploit buffer overflow or other remote code execution
- vulnerabilities in native applications that receive shares. There is no
- general way to guard against this, but implementors will want to be
- aware that it is a possibility.
+
- The three members title, text, and url, are part of the
- base feature set, and implementations that provide
-
+ The three members title, text, and url, are part
+ of the base feature set, and implementations that provide
+ navigator.share() need to accept all three. Any new members that
+ are added in the future will be individually
feature-detectable, to allow for backwards-compatibility with
- older implementations that don't recognise those members. These new
+ older implementations that don't recognize those members. These new
members might also be added as optional "MAY" requirements.
- The
+ The share() method throws a TypeError if none of the
+ specified members are present. The intention is that when a new member
+ is added, it will also be added to this list of recognized members (so
+ as to not throw an error). This is for future-proofing implementations:
+ if a web site written against a future version of this spec uses
+ only new members (e.g.,
Editors of this spec will want to carefully consider the genericity of
navigator.share
need to accept all three. Any new
- members that are added in the future will be individually
+
discussion about how to provide feature-detection for dictionary
members. Web Share will use the mechanism produced by that discussion.
share
method throws a
- TypeError
if none of
- the specified members are present. The intention is that when a new
- member is added, it will also be added to this list of recognised
- members (so as to not throw an error). This is for future-proofing
- implementations: if a web site written against a future version of this
- spec uses only new members (e.g.,
- navigator.share({image: x})
), it will be valid in future
- user agents, but a TypeError
on user
- agents implementing an older version of the spec. Developers will be
- asked to feature-detect any new fields they rely on, to avoid having
- errors surface in their program.
+ navigator.share({image:
+ x})
), it will be valid in future user agents, but a
+ TypeError on user agents implementing an older version of the
+ spec. Developers will be asked to feature-detect any new fields they
+ rely on, to avoid having errors surface in their program.