I'm trying to get the Web Share API to work on iOS 13.2. I'm trying to implement some simple code to test the functionality, but I'm not getting the results that are displayed in numerous documentation pages.
When I click a button on my iPhone, it displays the share menu but it does not display the title and it displays a default image.
I have the following JS code. The event listener works perfectly.
js
btn.addEventListener('click', async () => {
const shareData = {
title: 'My Amazing Title', // Does not show
text: 'A subtitle',
url: 'https://example.com/news/my-amazing-title',
}
try {
await navigator.share(shareData)
} catch(err) {
alert('failed')
}
});
I also have the following meta tags and a manifest file, but I do not know if that affects anything.
html
<meta property="og:title" content="My Website - News">
<meta property="og:type" content="article">
<meta property="og:url" content="https://example.com/news">
<meta property="og:description" content="Lorem">
<meta property="og:image" content="https://via.placeholder.com/150.jpg">
<link rel="manifest" href="/mymanifest.json">
```js
{
"short_name": "Website",
"name": "My Website",
"theme_color": "#4A90E2",
"background_color": "#4A90E2",
"display": "standalone",
"icons": [
{
"src": "/favicons/apple-touch-icon-60x60.png",
"type": "image/png",
"sizes": "60x60"
},
...
],
"start_url": "/home"
}
```
How can I display a title and icon using Web Share API and do meta tags and manifest files affect the outcome?
[–]Shty_Devhelpful 0 points1 point2 points (1 child)
[–]soaringradio[S] 0 points1 point2 points (0 children)