diff --git a/index.html b/index.html index eb17917..2630c11 100644 --- a/index.html +++ b/index.html @@ -92,6 +92,25 @@
+ Calling {{Navigator/canShare()}} method with a {{ShareData}} dictionary + [=validate share data|validates=] the shared data. unlike + {{Navigator/share()}}, it can be called without [=transient + activation=]. +
++ const file = new File([], "some.png", { type: "image/png" }); + + // Check if files are supported + if (navigates.canShare({files: [file]})) { + // Sharing a png file would probably be ok... + } + + // Check if a URL is ok to share... + if (navigates.canShare({ url: someURL })) { + // The URL is valid and can probably be shared... + } +
partial interface Navigator { [SecureContext] Promise<undefined> share(optional ShareData data = {}); + + [SecureContext] boolean canShare(optional ShareData data = {}); };
@@ -257,6 +278,25 @@
+ When the canShare(data) method is called with argument + {{ShareData}} |data:ShareData|, run the following steps: +
+