hermit-V2/assets/js/link-share.js
2023-11-06 08:26:39 +00:00

7 lines
No EOL
374 B
JavaScript

async function linkShare(t, u, s){
let shd = {title: t,text: s,url: u};
if(navigator.canShare(shd)){
try {await navigator.share(shd);} catch (er) {console.error(er);}
}else if (navigator?.clipboard?.writeText){
try {await navigator.clipboard.writeText(u);} catch (err) {console.error(err);}
}else{console.log("Neither WebShare API nor CLipboard API is supported")}}