Pregunta

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

¿Fue útil?

Solución

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

Otros consejos

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top