Reputation: 245
I am facing a behaviour, I don't understand. In Firefox 54.0 I have implemented a pretty simple Javascript to make an Ajax-request.
The Firefox works well, but doesn't stop to show the spinning wheel in the tab. This seems to be not a real problem but I always get asked, why. Does anyone know the reason? Chrome dosn't show that problem, only Firefox.
Regards
<!doctype html>
<html>
<head>
<title>Ajax</title>
<meta charset="utf-8">
<script type="text/javascript"> var meinRequest = new XMLHttpRequest();
meinRequest.open ( 'GET', 'daten.txt', true );
meinRequest.onreadystatechange = function(){
if ( meinRequest.readyState == 4 && meinRequest.status == 200 ){
document.write ( meinRequest.responseText );
} else if ( meinRequest.readyState == 4 ){
console.log ( 'Fehler ' + meinRequest.status );
}
}
meinRequest.send();
</script>
</head>
<body>
</body>
</html>
Upvotes: 0
Views: 179
Reputation: 245
Okay, just found the answer myself:
The document.write() forces firefox to expect more. I simple replaced it with
document.body.innerHTML += ( meinRequest.responseText );
Upvotes: 0