0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

web share api level2 ファイルor画像付きのシェア

Posted at
async share() {
      const imgPath = '/image/path.png'
      const blob = await (await fetch(imgPath)).blob()
      const file = new File([blob], 'image.png', { type: blob.type })
      navigator
        .share({ text: 'share...', url: null, files: [file] })
        .catch((error) => {
          console.error(error)
        })
    },

画像またはファイルを複数添付したい場合はfiles配列に追加すれば良い。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?