Window.showDirectoryPicker()
Draft: This page is not complete.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
The showDirectoryPicker()
method of the Window
interface displays a directory picker which allows the user to select a directory.
Syntax
var FileSystemDirectoryHandle = window.showDirectoryPicker();
Parameters
None.
Return value
Exceptions
AbortError
-
Thrown if the user dismisses the prompt without making a selection, or if the user agent deems the selected content to be too sensitive or dangerous
Examples
This asynchronous function shows a directory picker and returns a FileSystemDirectoryHandle
once selected.
async function getDir() { const dirHandle = await window.showDirectoryPicker(); // run code for dirHandle }
Specifications
Specification |
---|
File System Access # api-showdirectorypicker |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
showDirectoryPicker |
86 |
86 |
No |
No |
72 |
No |
No |
No |
No |
No |
No |
No |
See also
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Window/showDirectoryPicker