AJAX in IE7 and its so called native xmlhttp

During a recent project with a bent on improving UI we decided to take a look at what happened if an over zealous IT administrator in a company decided to disable activeX on his pure Internet Explorer environment. The results were disturbing therefore justifying the mantra that mission critical apps should still be functional without […]
October 17, 2007 7:50 am

During a recent project with a bent on improving UI we decided to take a look at what happened if an over zealous IT administrator in a company decided to disable activeX on his pure Internet Explorer environment. The results were disturbing therefore justifying the mantra that mission critical apps should still be functional without javascript and ajax. (Makes you want to dive into Flex huh? All that environment to do with as you please.) The good folks over at JQuery believe that IE 7’s implementation of native AJAX, i.e. a request that is not reliant on ActiveX such as Firefox, is flawed, so they simply use the ActiveX object. You can see this in the jQuery source

(at about line 2290 in 1.2.1):

This becomes a problem when you use jQuery exclusively and the aforementioned authority challenged IT admin has been allowed to run his path. We made our way around this by taking the Browser detect code from QuirksMode and writing a small piece of JavaScript that tries to create an ActiveX object when the browser is reported as IE.

Now all of our ajax type code is wrapped in:

I dont know if there is another way around this with jQuery, but it works for our purposes right now. I would be interested to know if any jQuery’ers out there can share a better solution. Further reading:

Oh, and to test if your app will work properly go into Tools > Internet Options > Security > Internet > Custom Level > and disable “Run ActiveX controls and plugins” and “Script ActiveX controls marked safe for scripting*”, restart IE and go take a look at your site.

Leave a Comment

Login
Log in below to access your courses.
Log In With Google
Forgot Password
Enter your email address or username and we’ll send you instructions to reset your password.