我们可以使用手机(android/Iphone)本机共享功能来共享应用程序中的不同内容。是否也可以在所有智能手机中使用 JavaScript 通过浏览器调用此共享功能?这样,在浏览器中的某些事件中,我们可以加载共享小部件。
Thanks.
是的,现在您可以使用 Android 版 Javascript 共享它。
如果您需要更多详细信息或表示感谢,请点击链接
https://sdtuts.com/javascript-android-native-share-popup-navigator-share-api/ 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');
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)