1

I have the following Codepen: https://codepen.io/Jsbbvk/pen/vYeRBZy

const onClick = async () => {
  const blob = await (await fetch("https://source.unsplash.com/random")).blob()
  const file = new File([blob], 'img', {type: blob.type})
  navigator.share({title: 'image', text: 'image', files: [file]})
}

document.getElementById("share").addEventListener("click", onClick)

On mobile, this is what it looks like when you press the button image sharing

There is no preview of the image before sharing it. Below is the intended result (which was achieved by long-pressing a random image and pressing "share") intended
Is there a way to achieve this image preview?

Jsbbvk
  • 180
  • 2
  • 19

1 Answers1

0

I have tried this with a demo and come to the conclusion that this seems to be a limitation in Safari. It works fine with image preview in Android.

What I don't get is why it works in another demo (click the Share button and you see a preview), but not in the demo above. In Share 4 I tried to exactly reproduce what my code does, but it doesn't seem to work.

It may just be a WebKit bug, I honestly don't know what's wrong and different between the two demos.

DenverCoder9
  • 2,024
  • 11
  • 32