0
我们如何从项目文件路径中将文本文件的内容复制到JavaScript中的字符串变量。Javascript:从项目文件夹中读取文本文件到字符串
我使用下面的代码,但它给出了“访问被拒绝”错误。
var sHTML = "";
var rawFile = new XMLHttpRequest();
rawFile.open("GET", "file://~/Templates/NewGridTemplate.txt", true);
sHTML = rawFile.responseText;
这可能有助于https://stackoverflow.com/questions/13709482/how-to - 读取文本文件,在JavaScript的 – xxLITxx