使用jquery从javascript加载.txt文件 [英] Load .txt file from javascript with jquery

查看:105
本文介绍了使用jquery从javascript加载.txt文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想加载本地.txt文件并使用javascript中的内容。
我的本地文件类似于C:\Users \Who \Desktop\file.txt
谢谢

I want to load a local .txt file and work with the content in javascript. My local file is like C:\Users\Who\Desktop\file.txt Thanks

推荐答案

默认情况下,出于安全原因,不允许javascript访问本地文件系统。如果您想允许特定脚本访问本地文件,那么您有2个选项。

by default javascript is NOT allowed to access local file system for security reasons. If you want to allow a particular script access to a local file then you have 2 options.

1a。更改您的模型,将文本文件放在服务器上并从那里加载...

1a. Change your model, put the text file on a server and load from there...

1b。运行本地网络服务器:-)

1b. Run a local webserver :-)

2 ...这取决于浏览器,

2 ... this becomes browser dependent,

特别是

您可以创建一个ActiveX插件,允许对IE类型进行本地访问...;

you can create an ActiveX plugin that allows local access for IE types... ;

其他任何东西再次读取本地访问。

and for anything else again read up o local access.

这篇关于使用jquery从javascript加载.txt文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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