Opened 5 years ago

Last modified 2 years ago

#18256 new defect

IE 8/9 - error while checking existence image with extension JPG at a certain path (status 200 of 404) using "handle"

Reported by: cjolif Owned by: dylan
Priority: undecided Milestone: 1.15
Component: IO Version: 1.9.3
Keywords: Cc:
Blocked By: Blocking:

Description

This bug is only for IE 8 and IE 9.

When executing this code to verify if an image is available (status 200) or not (status 404) considering a specific path (this.imagePath):

 var xhrArgs = {
   url: this.imagePath,
   sync: true,
   preventCache: true,
   failOk: true,
   handle: dojo.hitch(this, function(error, ioargs) {
      if (ioargs.xhr.status === 200) {
     this.imageAvailable = true;
      }
   })
 };   
 dojo.xhrGet(xhrArgs);

with a PNG image, everything works fine. with a JPG image, in IE 8 and IE 9, the "ioargs.xhr" results is undefined.

The reason is in the module "dojo/request/xhr"

where:

function handleResponse(response, error){
    var _xhr = response.xhr;
    response.status = response.xhr.status;
    response.text = _xhr.responseText;
    ...
}

In IE 8 and IE 9 the "_xhr.responseText" generates an error. SCRIPT58644: Could not complete the operation due to error c00ce514.

Checking the forums it seems in IE we should use "responseBody" instead of "responseText".

Quoting: "IE can not fetch the binary stream from XMLHttpRequest.responseText like all the other browsers. Therefore, we got to pull the data out from MS proprietary XMLHttpRequest.responseBody" http://miskun.com/javascript/binary-file-loading-in-javascript/

Attached example.

Attachments (1)

Dojo_12511.html (1.5 KB) - added by cjolif 5 years ago.

Download all attachments as: .zip

Change History (3)

Changed 5 years ago by cjolif

Attachment: Dojo_12511.html added

comment:1 Changed 3 years ago by dylan

Component: CoreIO
Milestone: tbd1.12
Owner: set to dylan

comment:2 Changed 2 years ago by dylan

Milestone: 1.131.15

Ticket planning... move current 1.13 tickets out to 1.15 to make it easier to move tickets into the 1.13 milestone.

Note: See TracTickets for help on using tickets.