Even I use Clipboard API but with the support for fallback like below,
(FB/Instagram browser doesn't support just clipboard API)
async function copyLink(){
try{
await navigator.clipboard.writeText(link);
console.log("Link Copied");
}
catch(e){
copyToClipbordFallback(link);
console.log("Link Copied");
}
}
function copyToClipbordFallback(text){
const textArea = document.createElement("textarea");
textArea.value = text;
document.body.appendChild(textArea);
textArea.select();
document.execCommand("copy");
textArea.remove();
}
so this fallback is mainly for FB/IG Browsers and other old browsers