In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
JavaScript how to increase the local operation API to directly manipulate the local file, in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.
Chrome, IE and Firefox have all enhanced the execution efficiency of the JavaScript engine in the new version. With the significant improvement of JavaScript efficiency in major browsers, JavaScript can do more and more things. The introduction of local file API will make a lot of interesting features come true.
A few days ago, Mozilla submitted a draft to the W3C that aims to launch a JavaScript API that allows JavaScript scripts to manipulate local files directly. There is a lot of support for this API in the browser version of Firefox, but for security reasons, the API will only provide limited access to local files.
An example is given to explain the slow effect of Javascript
Explain the Array extension in Javascript in detail
Showdown JavaScript HTML5 script API Preview
The Javascript and CSS menus recommend 13 items
Exploring the JavaScript Development tool Closure of Google
The API introduces a FileReader object that can load files in the local file system asynchronously, and allows developers to assign callback functions for events such as load failure, progress, load completion, etc., it provides methods to read text or binary data from local files and interrupt the operation at any time through an abort method.
The FileReader object makes file access on the client a reality, and users no longer have to upload the file to the server first as before. In fact, IE and Firefox already have some non-standard methods to access local files, but these methods are not standard JavaScript behavior.
FileReader object does not require special permissions, but for obvious security reasons, direct access to the file path is not allowed, must be combined with regular HTML file objects, users click to browse, select the local file, JavaScript and then reference the file through DOM and operate, this mechanism makes the API relatively more secure, because the acquisition of any local files requires the human participation of users.
The following example uses the API to open a local file and display the contents of the file in a div container. We can even add the contentEditable attribute on the div, and the user can edit the contents of the file directly. However, the API does not provide a way to write the contents of the file back to the local file, so the content you edit cannot be saved.
Although adding API to JavaScript is not a major technological revolution, it will expand the horizons of Web applications and enable the Web platform to achieve more and more functions.
The answer to the question about how JavaScript increases the local operation API to directly manipulate local files is shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.