imacros - read text file using javascript

2019-08-11 05:48发布

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

2条回答
唯我独甜
2楼-- · 2019-08-11 06:02

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

查看更多
迷人小祖宗
3楼-- · 2019-08-11 06:03

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();

查看更多
登录 后发表回答