I am working on an AJAX web service application this days. A typical AJAX web services now-a-day usually follows the MVC model (MVC stands for Model-View-Controller). The view is usually a client side that is written in Javascript and runs entirely in a browser. The "J" in AJAX is for Javascript. Having the application run in a browser avoids the hassle of installation, and enables easy access from any computer in the world.
Javascript has gone a long way. The DOM objects have made programming the entire UI in a web page possible. Various programming helper packages, such as Prototype and Mochi, have helped making it a lot easier. Although I have to say that programming and debugging in Javascript is such a pain.
Programming in Javascript to run in a browser does have a lot of limitations. One of them is that Javascript has no access on the local file systems. This is indeed a security consideration. Javascript may be run with simply loading of a web page. Without such restriction, the malicious code would be destroying or stealing one's local data in no time. This general introduction of Javascript has a really well written explanation.
What if a Javascript application does have a legitimate need to access the local file system? Microsoft provides a built-in ActiveX object named Scripting.FileSystemObject. Here are some examples on how it may be used. The FileSystemObject (FSO) has its own limitations. It only allows accessing to files in text mode, and of course it only works with Internet Explorer. If more complicated access is necessary, the best way seems is writing one's own ActiveX objects for Internet Explorer and plugins for Mozilla Firefox.
No comments:
Post a Comment