admin管理员组

文章数量:1336367

I'm currently using Navigator.share() to invoke the native share API. Everything is fine and dandy except what I'm sharing is a link to an image.

On iOS, there is a preview image that shows up when using Safari's share icon and I can't figure out how to get that to show up for Navigator.share() as well.

Navigator.share()

Here is an example of the same page being shared using Safari's browse share tool.

Safari's browser share tool

I'm currently using Navigator.share() to invoke the native share API. Everything is fine and dandy except what I'm sharing is a link to an image.

On iOS, there is a preview image that shows up when using Safari's share icon and I can't figure out how to get that to show up for Navigator.share() as well.

Navigator.share()

Here is an example of the same page being shared using Safari's browse share tool.

Safari's browser share tool

Share Improve this question edited Jun 13, 2020 at 0:07 Sowjanya R Bhat 1,16810 silver badges21 bronze badges asked Jun 12, 2020 at 19:12 Tommy PhamTommy Pham 911 silver badge7 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

I believe I came across a solution.

The data Navigator.share() is expecting can contain the properties: title, text, url, and files. I only use title, text, and url. I decided to omit title and text and it worked! I'm guessing it's because when they are set, the API doesn't use the meta information provided by the page to produce the preview image.

本文标签: javascriptHow to add a preview image to Navigatorshare()Stack Overflow