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

Answers:

Answer

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.

Answer

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.

Answer

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.

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.