I'm just running a simple test to measure download speed through normal use. The script uses a HTTP
request to download the file from a different server (which allows cross-domain requests).
Everything XMLHttpRequest
. I have to support IE 8 and 9, so I use XDomainRequest
in those browsers. Then, everything works - but the result is very different than the modern browsers.
In the modern browsers on my network, I get a download speed of 300-400 Mbps. In IE8 / 9, download speeds are continuously 20-40 Mbps.
I can not see anything wrong in my code, but before this I want to ask a different statement from the statement: it is XDR
naturally XHR Slower than
I would like to be able to say, "Sorry, boss, these are the limitations we face to support old, defective browsers, but I need to make sure."
For completeness - - There is nothing remarkable about this - I include a simplified version of my script:
var isXDR = window.XDomainRequest & amp; (Window.XMLHttpRequest and new XMLHttpRequest (). Response type === undefined), is the API = window Display & amp; The window in 'now' Display, request, url = 'http://xdomain.server.com/file.bin', start-up, duration, feedbackhandler = function () {period = (hyphenspi? Window) display: + new date ()) - start time; / * More stuff * /}; StartTime = Is the Impact API? Window.performance.now (): + New Date (); If (isXDR) {req = new XDomainRequest (); Req.onload = responseHandler; Req.open ('GET', url); } And {req = new XMLHttpRequest (); Req.open ('GET', URL, true); Req.onreadystatechange = function () {if (req.readyState === 4) {responseHandler (); }}; } Req.ontimeout = function () {/ * Accessories *}; Req.timeout = 10000; Req.send (zero); Therefore, due to the discrepancy between IE8 / 9 and XDR
the modern code is slower than the XHR
, or I Need to sift more closely through your code?
No comments:
Post a Comment