imacros - read text file using javascript

こ雲淡風輕ζ 提交于 2019-12-24 08:55:38

问题


I want to read text file using javascript not using imacros loop

I tried to read it using java with no luck

function frdln(n){ var fr,s=''; try{

fr=new java.io.BufferedReader(new java.io.FileReader(n));

s=fr.readLine();

if(s==null){s=''}else{s=''+s};

fr.close();

fr=null;   }catch(e){

alert(''+e);   };   return s; };

give me message error "ReferenceError: java is not defined"

Note:I installed latest version of java and the same error appear

if there is any other way to read text file or fix my code because I have no idea


回答1:


using javascript this can work XMLHttpRequest() but XMLHttpRequest() is no longer supported in firefox 15+ You must have to define it:

const XMLHttpRequest = Components.Constructor("@mozilla.org/xmlextras/xmlhttprequest;1"); var request = XMLHttpRequest();




回答2:


Install FireFox 15 and don't update it and that function will work. Java is not supported in FF16+ but in FF15 it works.



来源:https://stackoverflow.com/questions/21953736/imacros-read-text-file-using-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!