Skip to content
Permalink
Browse files

Add a flag to verify if a browser supports some form of XHR request. …

…Fixes #7030.
  • Loading branch information...
jeresig committed Sep 13, 2010
1 parent 1ed4051 commit 959c20f76866c17e12e0c0bd2b2a8753d618550b
Showing with 3 additions and 0 deletions.
  1. +3 −0 src/ajax.js
@@ -686,6 +686,9 @@ jQuery.extend( jQuery.ajax, {

});

// Does this browser support XHR requests?
jQuery.support.ajax = !!jQuery.ajaxSettings.xhr();

// For backwards compatibility
jQuery.extend( jQuery.ajax );

2 comments on commit 959c20f

@jdalton

This comment has been minimized.

Copy link
Member

replied Sep 14, 2010

So is it safe to assume if window.XMLHttpRequest exists there won't be some kind of error when calling xhr() should there be a try-catch for this flag ?

@jeresig

This comment has been minimized.

Copy link
Member Author

replied Sep 14, 2010

That's probably a safe assumption - we don't wrap the xhr() call in a try/catch now, inside ajax(), and we don't have problems. Most of the exceptions occur either with setting headers or sending.

Please sign in to comment.
You can’t perform that action at this time.