Use the native Web Share API for mobile-friendly sharing:
Report incorrect code
Copy
Ask AI
async function shareCallInvite() { const shareData = { title: "Join my call", text: "Click the link to join my video call", url: `https://yourapp.com/call/${sessionId}` }; if (navigator.share) { try { await navigator.share(shareData); console.log("Shared successfully"); } catch (error) { console.log("Share cancelled or failed"); } } else { // Fallback for browsers that don't support Web Share API copyToClipboard(shareData.url); }}
function copyToClipboard(text) { navigator.clipboard.writeText(text).then(() => { console.log("Link copied to clipboard"); // Show a toast notification }).catch(err => { console.error("Failed to copy:", err); });}
Create a custom share dialog with multiple options:
Report incorrect code
Copy
Ask AI
function showShareDialog() { const callLink = `https://yourapp.com/call/${sessionId}`; // Show your custom dialog with options like: // - Copy link // - Share via email // - Share via SMS // - Share to social media}