Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #8259 (new defect)

Opened 2 years ago

Last modified 8 months ago

[PATCH] Ajax.Request/.Update does not work with files on IE7 with native XMLHttpRequest

Reported by: hagen.seifert Assigned to: sam
Priority: low Milestone: 2.x
Component: Prototype Version: edge
Severity: minor Keywords: IE7
Cc:

Description

Hello,

the following test code shows, that prototypes Ajax object does not work with files (servlets are working) if IE7 is configured with native XMLHttp support (default setting).

<html><head>
  <meta http-equiv="Content-Script-Type" content="text/javascript">
  <script type="text/javascript" src="scripts/prototype.js"></script>
  <script type="text/javascript">
  function load()
  {
    new Ajax.Request('/your.file',
    {
      method:'get',
      onSuccess: function(transport){
        var response = transport.responseText || "no response text";
        alert("Success! \n\n" + response);
      },
      onFailure: function(){ alert('Something went wrong...') }
    });
  }
  </script>
</head>

<body onload="load();">
Ajax Test
</body></html>

Best regards,

Hagen T Seifert

Attachments

ajax_ie7_filesystem.diff (1.2 kB) - added by jdalton on 03/30/08 07:17:28.

Change History

05/03/07 11:12:33 changed by Semperor

Update: I found out, that IE7 executes the Ajax call if the page runs over a web server like tomcat.

06/18/07 22:52:52 changed by savetheclocktower

  • priority changed from high to low.
  • severity changed from major to minor.

This is a "nice-to-have" feature, but I don't think we can guarantee any sort of consistent Ajax behavior with the "file" protocol (especially across browsers). We'll keep this in mind for future releases.

07/17/07 10:55:43 changed by namxam

I might be wrong, but what does it have to do with the file protocol? Isn't this case what almost every request looks like? Because right now I have exactly the same problem with an .aspx page. Every browser just processes the request except of the IE7 which retrieves the data, but is unable the div which should receive the update. very strange!

03/27/08 05:28:50 changed by jdalton

the native XMLHttpRequest in IE7 does not work with local filesystems.
Good news is that the regular activeX method of ajax does.
Simply use the traditional ajax for IE7 if you /ftp:/.test(widnow.location.href)[[BR]] I will make a patch soon.

03/30/08 07:17:05 changed by jdalton

  • summary changed from Ajax.Request/.Update does not work with files on IE7 with native XMLHttpRequest to [PATCH] Ajax.Request/.Update does not work with files on IE7 with native XMLHttpRequest.

If the html file and ajax request is from the local file system you can read files via ajax. Patch allows IE7 to fallback to the activex control when running from the filesystem so it will can load files as well.

I also optimized the getTransport() method.

03/30/08 07:17:28 changed by jdalton

  • attachment ajax_ie7_filesystem.diff added.

04/03/08 13:29:48 changed by jdalton