Post

Replies

Boosts

Views

Activity

iOS Safari does not respect URL provided via Web Share API (Navigator.Share(data)))
Hi Apple developers, I am building a web application (HTML/CSS/Javascript) which can be installed on any site. I would like to use the Web Share API to enable users to easily share a link to my application. Specifically I am using the Navigator.share(data) method (https://developer.mozilla.org/en-US/docs/Web/API/Navigator/share) I am however running in to a number of issues on iOS and Safari, that I hope someone here can help answer, as I have not been able to find documentation, that supports/explains my findings. URL with query string parameters Let's assume my application is executing on domain-x.com. Using Navigator.share(data) I try to share a URL with query string parameters (simplified sample). onShareButtonClick(event) { Navigator.share({ url: "https://domain-x.com?somevariable=xyz", title: "Some Title" }); } When clicking the button which is hooked up to the eventhandler above, the share dialogue opens up correctly, but if I select sending via any message platform like Messenger, iMessage or other, the link being shared is without the query string - just https://domain-x.com. However if I click the Copy button, the full URL (https://domain-x.com?somevariable=xyz) is copied. URL different from application domain Let's assume my application is executing on domain-x.com. Using Navigator.share(data) I try to share a URL with another domain - domain-y.com (simplified sample). onShareButtonClick(event) { Navigator.share({ url: "https://domain-y.com/some-page", title: "Some Title" }); } When clicking the button which is hooked up to the eventhandler above, the share dialogue opens up correctly, but if I select sharing via any message platform like Messenger, iMessage or other, the link being shared is to the current page URL - eg. https://domain-x.com/current-page - not https://domain-y.com/some-page. However if I click the Copy button (again), the correct URL (https://domain-y.com/some-page) is copied. Do anybody know if this is the expected behavior on iOS? The share functionality works as expected on Android devices. I am thinking Apple is removing the query string parameters as part of their privacy initiatives. Is removing the ability to share URL's with other domains than the application is running on part of a similar strategy? Please help me with links or insights as to why this is happening - links to documentation or other forum posts are much appreciated - or am I simply doing something wrong? Thanks a lot in advance :)
6
1
2.5k
Feb ’23