TEXT: navigator.share({title: '...', text: '...'})
URL: Share URL to native apps
FILES: Share images and documents
Drag files here or click to browse
Images, PDFs, and documents supportedUse the controls on the left to test different sharing scenarios
// Basic Web Share API implementation
async function shareContent() {
if (!navigator.share) {
console.log('Web Share API not supported');
showFallbackOptions();
return;
}
const shareData = {
title: 'My Awesome App',
text: 'Check out this amazing content!',
url: 'https://example.com'
};
try {
await navigator.share(shareData);
console.log('Content shared successfully');
} catch (error) {
if (error.name === 'AbortError') {
console.log('Share was cancelled by user');
} else {
console.error('Error sharing:', error);
}
}
}
// File sharing with Web Share API
async function shareFiles(files) {
if (!navigator.canShare || !navigator.canShare({ files: files })) {
console.log('File sharing not supported');
return;
}
const shareData = {
title: 'Shared Files',
text: `Sharing ${files.length} file(s)`,
files: files
};
try {
await navigator.share(shareData);
console.log('Files shared successfully');
} catch (error) {
console.error('Error sharing files:', error);
}
}
// Complete Web Share API with social fallbacks
class AdvancedWebShareManager {
shareToSocial(platform) {
const title = document.getElementById('shareTitle').value;
const text = document.getElementById('shareText').value;
const url = document.getElementById('shareUrl').value;
let shareUrl = '';
switch(platform) {
case 'x':
shareUrl = `https://x.com/intent/tweet?text=${encodeURIComponent(text)}&url=${encodeURIComponent(url)}`;
break;
case 'facebook':
shareUrl = `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(url)}`;
break;
case 'instagram':
alert('Open Instagram and share manually. Copied caption to clipboard!');
navigator.clipboard.writeText(text);
break;
case 'whatsapp':
shareUrl = `https://api.whatsapp.com/send?text=${encodeURIComponent(text + ' ' + url)}`;
break;
}
if (shareUrl) {
window.open(shareUrl, '_blank');
}
}
}
Compare database schemas and generate migration scripts. Ana...
Generate realistic mock API responses instantly. Create REST...
Detect and analyze browser memory leaks in JavaScript applic...
Convert JSON to TypeScript models instantly. Free online too...
Master complex calculations with professional mathematical tools designed for business, engineering,...
Explore comprehensive weather analysis and astronomical tracking tools for outdoor planning, health ...
Master technical SEO with comprehensive meta tag optimization strategies. Learn to create compelling...
Discover the most powerful JSON tools for modern development workflows. From formatting and validati...