Clipboard & Sharing
File Sharing
Verify navigator.canShare() file sharing support and pass File objects to native share target.
Checking support...
Feature Not SupportedThis browser does not support the File Sharing Web API feature. Try testing in a modern browser (such as Chrome, Edge, Safari, or Firefox).
Advertisement
Interactive Input Workspace
Ready for input
Web API Execution Output
Result output will be displayed here after processing...
Native JavaScript Code Example (Zero Libraries)
const file = new File(['hello'], 'hello.txt', { type: 'text/plain' });
if (navigator.canShare && navigator.canShare({ files: [file] })) {
await navigator.share({ files: [file] });
}About the File Sharing Web API
navigator.canShare checks whether specific File arrays can be broadcast via Web Share API.
Specification:W3C & WHATWG Web API Standard
Sponsored Content