Hello everbody!
I want to tell you about a "funny" error I've found making an
Ajax.Request with Internet Explorer 7 and Prototype 1.7.
Please. considering this very standard code:

function ajaxCall(url, callbackResponse) {
        try{
                new Ajax.Request(url, {
                  method: 'get',
                  asynchronous: true,
                  onSuccess: function(transport) {
                    callbackResponse_1();
                    callbackResponse_2();
                  }
                });
        } catch (exception) {
        alert(exception.inspect());
        }
}

When trying to execute those lines the Ajax.Request never happened,
not only the callback method, even the very first
"transport.send(url)" never starts. Googling and debugging a bit, I've
found out the root of my problem:

Basically the cause of bug is the well know poor designed
XMLHttpRequest implementation of IE7 which is really buggy ad won't
work as we expected. Anyway there's is also a prototype issue. In fact
in version 1.7 sources there are these lines of code:

var Ajax = {
  getTransport: function() {
    return Try.these(
      function() {return new XMLHttpRequest()},
<-------------------------------
      function() {return new ActiveXObject('Msxml2.XMLHTTP')},
      function() {return new ActiveXObject('Microsoft.XMLHTTP')}
        ) || false;
  },

[......]

that try to create XMLHttpRequest object in a "browser-compatibility"
way. Anyway because IE7 supports XMLHttpRequest, but it's buggy, those
lines force it to use a buggy implementation instead of less-good-but-
working Activex one.
I wouldn't call it a "prototype bug" but it's a fact that at least one
old version (I've seen it on 1.4) had a slightly different
implementation:

var Ajax = {
  getTransport: function() {
    return Try.these(
      function() {return new ActiveXObject('Msxml2.XMLHTTP')},
      function() {return new ActiveXObject('Microsoft.XMLHTTP')},
      function() {return new XMLHttpRequest()}
<-------------------------------
    ) || false;
  },

which perfectly works with different browser (IE 7/8, FF3, Chrome for
sure).

I hope that my post will be of help for someone else.

Best Regards.

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to