7 lines
377 B
JavaScript
7 lines
377 B
JavaScript
|
async function linkShare(t, u, s){
|
||
|
let data = {title: t,text: s,url: u};
|
||
|
if(navigator.canShare(data)){
|
||
|
try {await navigator.share(data);} 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")}}
|