读写文件usinbg javascript的代码 [英] code of reading and writting file usinbg javascript

查看:52
本文介绍了读写文件usinbg javascript的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

提供客户端使用javascript读取和写入文件的完整代码

give full code of readind and writing file using javascript by client side

推荐答案

如果您的JavaScript代码可以访问访问者的本地文件到您的站点,则它将是一个巨大的安全问题.这就是为什么没有浏览器会允许它的原因.
但是,有两种方法可以在获得用户许可的情况下实现:
1.使用 JavaScript扩展(可从JavaScript编辑器运行),或
2.使用网页和 ActiveX对象(仅Internet Explorer)

使用ActiveX对象为您提供了许多可能性,但是有两个明显的缺点:

一个.您需要一个网页来运行JavaScript,并且
b. ActiveX对象仅可用于Internet Explorer浏览器.

这是如何使用示例代码完成操作的完整细节.
如何在JavaScript中读取和写入文件 [
If your JavaScript code could access local files of the visitor to your site, it would be a huge security problem. That''s why no browsers would allow it.

But there are couple of ways to achievde it with users permission:
1. Using JavaScript extensions (runs from JavaScript Editor), or
2. Using a web page and ActiveX objects (Internet Explorer only)

Using ActiveX objects gives you many possibilities, but there are two distinct disadvantages:

a. You need a web page to run your JavaScript, and
b. ActiveX objects only work with the Internet Explorer browser.

Here is the full details of how you can get it done with sample code.
How to read and write files in JavaScript[^]


这篇关于读写文件usinbg javascript的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆