navigator.share (Web Share API) is not working inside a Webview
See original GitHub issueBug description:
I have a <WebView>
in my app built using Expo and React Native.
The webview opens a page that uses the Web Share API, i.e. navigator.share({ url: 'url' })
.
However, navigator.share
is not available inside the webview.
If the same page is opened within a normal browser, sharing works as expected.
To Reproduce:
Call navigator.share
from inside a page opened in a webview and see that it’s undefined.
Expected behavior:
navigator.share
should be defined and working.
Environment:
- OS: Android
- OS version: 8
- react-native version:
"react-native": "https://github.com/expo/react-native/archive/sdk-35.0.0.tar.gz",
- react-native-webview version:
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:19
Top Results From Across the Web
navigator.share is not working in a WebView - Stack Overflow
navigator.share is not working in a WebView · The URL is using https. · The share action is user-triggered by an onClick. ·...
Read more >765923 - Web Share API doesn't work in Android WebView
Currently we are using presence of `navigator. share` to detect this feature which creates bugs (e.g. https://github.com/ampproject/amphtml/issues/11473) for ...
Read more >Navigator.share() - Web APIs - MDN Web Docs
The navigator.share() method of the Web Share API invokes the native sharing mechanism of the device to share data such as text, URLs, ......
Read more >Simple sharing on the web with navigator.share - Paul Kinlan
How to get this working. · Get Chrome Dev Channel on Android. · Go to any page on my blog and click the...
Read more >WebView - Android Developers
To learn more about WebView and alternatives for serving web content, ... may be shared with other WebViews in the application, but is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Solution by overriding navigator.share() to forward param to react native side for handling:
Still an issue in 2022. Did anyone find a solution not involving Java or Koplin?