Originariamente inviato da /dev/null
Ehm, "file:///home/post.txt" dubito che possa riferirsi a "F:\home"... Mi sembra tanto un path Unixiano che si riferisce a "/home/post.txt" che su window non ha molto senso :ignore:
Comunque cose simili non sara' mai possibile farle, se non sfruttando bug o in altri modi vietati qua sul forum.
Già già
window.onload= function(){
try
{
loadUrl('file:///F:/home/post.txt');
}
catch(e){
alert(e);
}
}
Con questo codice (che funziona con IE e Opera)
FF doesn't work
ed è a synchronous request
Codice PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="JavaScript" type="text/JavaScript">
var req = null;
function processReqChange() {
if(req.status == 0){
alert(req.responseText);
}
}
function loadUrl( url ) {
if(window.XMLHttpRequest) {
try { req = new XMLHttpRequest();
} catch(e) { req = false; }
} else if(window.ActiveXObject) {
try { req = new ActiveXObject('Msxml2.XMLHTTP');
} catch(e) {
try { req = new ActiveXObject('Microsoft.XMLHTTP');
} catch(e) { req = false; }
} }
if(req) {
req.onreadystatechange = processReqChange;
req.open('GET', url, false);
req.send('');
}
}
window.onload= function(){
try
{
loadUrl('file:///F:/home/post.txt');
}
catch(e){
alert(e);
}
}
</script>
<body>
<h1>Walking the dog</h1>
<span id="moreSpan">
</span>
</body>
</html>
Per la cronaca con l'altro metodo
l'alert in FF scatta 5 volte tre volte
vuoto 2 con il risultato.