使用本地javascript获取脚本文件的内容

时间:2013-07-03 13:27:31

标签: javascript

类似How can I get the content of the file specified as the 'src' of a <script> tag?Getting content of a script file using Javascript,我想使用脚本标记来加载xml文件以使用javascript代码 - 只需要它来运行本地。 那么如何访问使用脚本标记加载的文件的内容?

1 个答案:

答案 0 :(得分:0)

你无法在本地实现这一目标。 加载脚本将执行它,并且不会授予您访问src的权限 那么你唯一的选择是将文件作为ajax调用加载。但是ajax调用在本地不起作用(由于安全性)。