Skip to content

Ajax breaks on IE8 if "Enable native XMLHTTP support" checkbox is uncheked #295

@IngusSkaistkalns

Description

@IngusSkaistkalns

In Internet Explorer 8 you can uncheck "Enable native XMLHTTP support" under Tools > Internet Options > Advanced. More info about this "special" feature -> http://msdn.microsoft.com/en-us/library/ms537505(v=vs.85).aspx

This breaks down something UJS ajax, but jQuery.ajax still works as usual (so this is why i made assumption that problem is under UJS scope).

Code for scenario:

Views:

<%= link_to "With UJS", ujs_test_path, class: "ujs", data: { remote: true, type: "text"} %>
<%= link_to "Without UJS", ujs_test_path, class: "simple" %>

Controller:

def ujs_test
  respond_to do |format|
    format.text { render text: "Ajax works as expected!"}
  end
end

Javascript:

$(document).ready(function(){
  $("a.ujs").live("ajax:success", function(e, data){
    alert(data);
  });

  $("a.simple").live("click", function(e){
    e.preventDefault();
    $.ajax({
      url: $(this).attr("href"),
      type: "GET",
      dataType: "text",
      success: function(data){
        alert(data);
      }
    })
  });
})

I didn't test this on IE7, but I have strong feeling there is the same issue, because i tested it on IE9 in three modes - IE7 mode (problem is present), IE8 mode (problem is present), IE9 mode (problem is not present).

I also tried to get some more information, so added this:

  $("a.ujs").live("ajax:error", function(jqXHR, status, errorThrown){
    window.myXHR = jqXHR;
    window.status = status;
    window.errorThrown = errorThrown;
    alert(errorThrown);
  });

On IE9 developer tools you can actually add objects to watch and you can inspect them, so under window.status property statusText value is "TypeError: Object doesn't support this property or method"

Thats where my investigation ends.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions