Skip to content Skip to sidebar Skip to footer

How To Use Javascript To Open A Folder And List Html File Names In That?

I want to list the names of HTML files in a particular folder using JavaScript (in the browser)... Can anybody help me in this? Thank You

Solution 1:

If you're using Javascript that's running in the browser, there's no way to "open a folder". You have to obtain data about the folder contents through some data structure or by doing something like parsing a server generated folder index in HTML.

If you're using Javascript that's running on a non-browser engine (such as jscript, rhino, etc.) then you have to be more specific in the question as the answer will obviously depend on whether the engine where your script is running provides objects to access the filesystem or not.


Solution 2:

This is what you are asking for:

http://www.irt.org/articles/js014/index.htm

Also read on FSO

But yes, if you can't use FSO if ActiveX is disabled on client system.


Solution 3:

Javascript can't interact with the OS while running inside a browser, due to security concerns.

It can get a list from the server and display that to the client on the browser, but, to get a directory structure from the client computer to the browser would require some other application reading the directory structure and sending it to the server, and the server sending it to the browser.

Now, if you are using Actionscript it is possible to read the hard drive, and I expect that Silverlight would allow you to do this also, but I don't know.


Post a Comment for "How To Use Javascript To Open A Folder And List Html File Names In That?"