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.
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.
var FileSystemDirectoryHandle = window.showDirectoryPicker();
None.
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
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 }
Specification |
---|
File System Access # api-showdirectorypicker |
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
|
© 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