share

Navigator インターフェイス share メソッド (DOM)

仕様書

引数

[19] urlURL オブジェクトを渡すと、 WindowsChromeiOSSafari文字列化して URL として解釈して共有ダイアログが表示されます (正しい動作)。

[20] ところが iOSChrome だけは、なぜかなにも表示しません。 はじめから文字列を渡すことで回避できます。

処理

[17] Promise が返されます。共有画面が開かれた後、満足されます。

[21] Windows Chrome では、 利用者が選択したり閉じたりする前に満足されます。

[22] iOS Chrome では、 利用者が閉じてから満足されます。

実装

[8] Android 版の Chrome が対応しています。共有画面がモーダル風に表示されます。

[9] Windows 版の Chrome は対応していません。 navigator.share 自体が存在しません。

[16] Windows 版の Chrome も対応しました。 Windows 標準の共有画面が表示されます。

[18] iOS 版の SafariChrome も対応しています。

[25] Mac 版の Chrome はまもなく対応する模様です。 >>24


[10] Android では候補にクリップボードコピーする選択肢がでてきますから、 URL利用者に与えたい時にはクリップボードコピーを直接実装するよりも便利かもしれません。

[11] ただし他の候補で公開の SNS アプリが出てきたりするので、 capability URL など非公開の URL を提示する時に使うのは避けたほうが無難です。


[28] files には WindowsChromeAndroidChrome もまだ対応していないようです。

歴史

[1] web-share/interface.md at master · mgiuca/web-share () https://github.com/mgiuca/web-share/blob/master/docs/interface.md

[2] New In Chrome 55  |  Web  |  Google Developers () https://developers.google.com/web/updates/2016/11/nic55

[3] web-share/explainer.md at master · mgiuca/web-share () https://github.com/mgiuca/web-share/blob/master/docs/explainer.md

[4] web-share/interface.md at master · mgiuca/web-share () https://github.com/mgiuca/web-share/blob/master/docs/interface.md

[5] WICG/web-share: Web API proposal for sharing data from a web page () https://github.com/WICG/web-share

[6] Introducing the Web Share API  |  Web  |  Google Developers () https://developers.google.com/web/updates/2016/09/navigator-share?utm_source=feed&utm_medium=feed&ut

[12] RFP: Web Share API · Issue #27 · mozilla/standards-positions () https://github.com/mozilla/standards-positions/issues/27

[13] Add Web Share and Web Share Target APIs to charter · Issue #105 · w3c/WebPlatformWG () https://github.com/w3c/WebPlatformWG/issues/105

[14] Web Share API · Issue #179 · w3ctag/design-reviews () https://github.com/w3ctag/design-reviews/issues/179

[15] Safari 12.1 Release Notes | Apple Developer Documentation () https://developer.apple.com/documentation/safari_release_notes/safari_12_1_release_notes

[23] chore: inform people that l2 is folded into main spec by marcoscaceres · Pull Request #134 · w3c/web-share () https://github.com/w3c/web-share/pull/134

[24] 1144920 - Web Share (navigator.Share) integration with Mac - chromium, https://bugs.chromium.org/p/chromium/issues/detail?id=1144920

[26] 1312422 - DOM implementation of Web Share API, https://bugzilla.mozilla.org/show_bug.cgi?id=1312422

[27] 1613292 - Web share impl is using a localized string for a web-visible exception, https://bugzilla.mozilla.org/show_bug.cgi?id=1613292