We can use phone's (android/ Iphones) native share functionality to share different content from apps. Is it also possible to invoke this share functionality through browser using javascript in all smart phones? So that on some event in browser, we can load share widget.
Thanks.
Yes now you can share it with Javascript for Android. Follow link if you need more details or say thanks
https://sdtuts.com/javascript-android-native-share-popup-navigator-share-api/
async function AndroidNativeShare(Title,URL,Description){
if(typeof navigator.share==='undefined' || !navigator.share){
alert('Your browser does not support Android Native Share');
} else {
const TitleConst = Title;
const URLConst = URL;
const DescriptionConst = Description;
try{
await navigator.share({title:TitleConst, text:DescriptionConst, url:URLConst});
} catch (error) {
console.log('Error sharing: ' + error);
return;
}
}
}
$(".share_button").click(function(){
AndroidNativeShare('My Page Title', 'https://google.com','This is description');
});
For iOS/Android it is only possible if a UIWebView is opened within an app, but not from the native Safari/Chrome standalone browsers.
From in-app web view: How to Call Native Iphone/Android function from Javascript?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With