Hi,

>From what I recall from a few years back, XMLHttpRequest asynchronous
requests do not work with local files, which I think may be the reason why
ActiveX is used. Maybe check if it is being used on a local page (not
tested), e.g.

xhr: function() {
 if (location.protocol !== "file:" && window.XMLHttpRequest &&
window.ActiveXObject)
 {
   return new XMLHttpRequest();
 }
 if (window.ActiveXObject) {
   try { return new ActiveXObject("Microsoft.XMLHTTP"); }
   catch(e) { }
 }
 if (window.XMLHttpRequest) {
   return new XMLHttpRequest();
 }
 return null;
}

--Sam

2010/1/5 Matt <m...@thekrusefamily.com>

> On Dec 31 2009, 1:52 pm, John Resig <jere...@gmail.com> wrote:
> > Landed and closed:http://dev.jquery.com/ticket/5735
>
> John, good to see this change in jQuery.
>
> Another ajax area that needs attention is the xhr creation:
>
> // Create the request object; Microsoft failed to properly
> // implement the XMLHttpRequest in IE7, so we use the ActiveXObject
> when it is available
> // This function can be overriden by calling jQuery.ajaxSetup
> xhr: function(){
>  return window.ActiveXObject ?
>    new ActiveXObject("Microsoft.XMLHTTP") :
>    new XMLHttpRequest();
>  }
>
>
> 1) What problems exist in IE7 that make you prefer ActiveX?
>
> 2) If an IE user has ActiveX disabled (common for many corporate
> users), this will throw a nasty error like:
> "Automation server can't create object"
> to the user and cause scripts to stop running. This is not good,
> especially if the user has IE>=7 with native XMLHttpRequest that would
> work fine.
>
> Assuming you want to keep ActiveX as the preferred method in IE (I'd
> like to know why) then I suggest:
>
> xhr: function() {
>  if (window.ActiveXObject) {
>    try { return new ActiveXObject("Microsoft.XMLHTTP"); }
>    catch(e) { }
>  }
>  if (window.XMLHttpRequest) {
>    return new XMLHttpRequest();
>  }
>  return null;
> }
>
> And then later in the ajax() method you need to check to make sure
> that xhr() doesn't return null. If it does, don't try to proceed.
>
> In fact, this should be a feature-test early on, so developers can
> decide whether ajax functionality will even be supported in the user's
> browser. Right now there isn't even a way to check for ajax support
> and degrade gracefully if it doesn't exist.
>
> jQuery.support.ajax = (xhr()!=null);
>
> Hope that helps some more,
>
> Matt Kruse
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "jQuery Development" group.
> To post to this group, send email to jquery-...@googlegroups.com.
> To unsubscribe from this group, send email to
> jquery-dev+unsubscr...@googlegroups.com<jquery-dev%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/jquery-dev?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-...@googlegroups.com.
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en.


Reply via email to