Quantcast

innerHTML not flushing in IE/chrome, but does in FF

$tinkle

Expert on blowing
Feb 12, 2003
14,591
6
the task is: ping the server & post to the page loopback times, using ajax w/ sync flag. this is needed for poor performing times to offer one data point, and does include in the result set various ssl/siteminder/load balancer negotiations, but they are not exposed, just inferred.

for ie/chrome, this is a typical result set:



when stepping through on the server-side debugger, the results are NOT posted to the ie/chrome browser until all ajax calls have finished, but firefox does post each result to the DOM as it's returned. so above results cannot be culled to just "finished ping <arbitrary step>", and the results screen captured in ie/chrome.

the google has been less than cooperative.

here's the ajax call:

Code:
<script language="JavaScript" type="text/javascript">

	var resDiv;
	var tot = 0;
	var startTime, endTime;
	var getPingArgs = {
		contentType: "application/json",
		url:"rest/servlet/ping",
		sync: true,
		preventCache: true,
		headers: {"Accept": "text/plain"},
		load: function (data) {
			endTime = new Date();
			delta = endTime - startTime;
			tot += delta;
		},
		error: function (error) {
			showMessage( "oops", error );
			console.log(error);
		}
	};
	function pingServer() {
		for (var pings=1; pings<11; pings++) {
			startTime = new Date();
			dojo.xhrGet(getPingArgs);
			resDiv.innerHTML += "<br> - finished ping #" + pings + ", which took " + delta + "ms";
		}
		resDiv.innerHTML += "<p style=\"font-family:arial; font-size:20px; text-align: center; font-style:bold; color:Lime\">test done.  10 pings took an avg of " + tot/10 + "ms each";
	}

	dojo.addOnLoad(function(){
		console.log("addOnLoad called");
		resDiv = dojo.byId("pingResultsDiv");
		pingServer();
	});