Lo he intentado , para un caso muuuuyyyyy particular , pero tampoco me sale . He cogido un script en la web para abrir un txt almacenar su contenido en una variable y... pero miralo tú mismo a ver si te vale de algo
Código HTML:
<body onload="abrirFichero()">
<script>
var contenido="hola ...no , no soy el contenido de fichero.txt , todavia ...";
function abrirFichero()
{
var fso,ageneral,root;
root="\\127.0.0.1\compartida\fichero.txt";
fso = new ActiveXObject("Scripting.FileSystemObject");
if (fso.FileExists(root)) //si existe
{
ageneral = fso.OpenTextFile(root,1, true); //se abre el archivo
while(!ageneral.AtEndOfStream ) //lee hasta final de fichero
{
contenido=contenido+ageneral.ReadLine(); //lee linea y anyade a la variable
}
ageneral.Close(); //cierra fichero
alert(contenido);
}
else //si no existe
{
alert("El fichero no existe");
}
document.writeln("<textarea rows=\"2\" name=\"S1\" cols=\"20\">");
document.writeln(contenido);
document.writeln("</textarea>");
setTimeOut("abrirFichero()",5000);
}
</script>
</body>