Browser Support
navigator.share
checking…
navigator.canShare
checking…
canShare({ files })
checking…
Secure context (HTTPS)
checking…
User Agent
1. Full payload
titletexturl
Share all three fields together — the most common usage.
navigator.share({ title, text, url });
2. URL only
url
Minimal share — many apps prefer just a URL and will fetch their own preview.
navigator.share({ url });
3. Text only
text
Plain text — no link previews. Good for SMS / Notes / clipboard targets.
navigator.share({ text });
4. Title only
titleoften rejected
Some platforms reject this — title is usually a hint, not a payload.
navigator.share({ title });
5. Title + URL
titleurl
Common pattern when sharing an article or page without a custom message.
navigator.share({ title, url });
6. Text + URL
texturl
Useful for chat apps — text becomes the message, url becomes the link.
navigator.share({ text, url });
7. Very long text
text 5000 chars
Stress test how the receiving app handles a large text body.
navigator.share({ text: 'A'.repeat(5000) });
8. Special characters
unicodeemoji
Tests emoji, RTL, accents, and quotes survive the share roundtrip.
navigator.share({
title: '🚀 Test — "quotes" & ñ',
text: 'مرحبا • العالم • 你好 • 🎉',
url
});
9. Invalid URL
should reject
Pass a malformed URL — should throw TypeError.
navigator.share({ url: 'not a real url' });
10. Empty payload
should reject
No data at all — must throw TypeError.
navigator.share({});
11. Share a file
filesrequires file input
Pick a file in the input above, then share it. Uses canShare({files}) first.
if (navigator.canShare({ files })) {
navigator.share({ files, title, text });
}
12. Share generated image
canvas → blobfiles
Generates a PNG via <canvas> at runtime and shares it as a file.
canvas.toBlob(blob => {
const file = new File([blob], 'qa.png', { type: 'image/png' });
navigator.share({ files: [file] });
});
13. Multiple files
2 files
Tries to share two generated files at once — many platforms only accept one.
navigator.share({ files: [fileA, fileB] });
14. File + text + URL
filestexturl
Combines a file with text and a URL. Some apps drop the URL when files are present.
navigator.share({ files: [file], text, url });
15. No user gesture
should reject
Calls share from a setTimeout — must fail because the call is outside a user gesture.
setTimeout(() => navigator.share({...}), 1000);