Before bothering with a server-side scripting language, I was wondering if JavaScript could download the list of files located in a directory on the server, and use them to fill a listbox in the browser:
Javascript can get a webpage, yes, but it cannot search a file structure on a server. If you’ve manually created a file that contains the directory structure, sure, but that’s not Javascript getting the structure from the server. It’s getting the structure from a file that you manually created. Not the same thing.
I think in most cases it is not desirable to expose folder contents. But I have seen examples where it was desired. eg. WordPress plugin SVN branches.
I would advise to not do this in a higher level htaccess file, but it could work in a folder specific htaccess file for a folder that had no “index” file.
Options +Indexes
Then JavaScript could parse the DOM to get the URLs from it.
Just be extremely careful about what is getting exposed.