Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
873c2842
Commit
873c2842
authored
Sep 28, 2010
by
John Resig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure we have a fallback when XMLHttpRequest is manually disabled. Fixes #6298.
parent
0368606c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
12 deletions
+24
-12
ajax.js
src/ajax.js
+24
-12
No files found.
src/ajax.js
View file @
873c2842
...
...
@@ -180,19 +180,10 @@ jQuery.extend({
password: null,
traditional: false,
*/
// Create the request object; Microsoft failed to properly
// implement the XMLHttpRequest in IE7 (can't request local files),
// so we use the ActiveXObject when it is available
// This function can be overriden by calling jQuery.ajaxSetup
xhr
:
window
.
XMLHttpRequest
&&
(
window
.
location
.
protocol
!==
"file:"
||
!
window
.
ActiveXObject
)
?
function
()
{
return
new
window
.
XMLHttpRequest
();
}
:
function
()
{
try
{
return
new
window
.
ActiveXObject
(
"Microsoft.XMLHTTP"
);
}
catch
(
e
)
{}
},
xhr
:
function
()
{
return
new
window
.
XMLHttpRequest
();
},
accepts
:
{
xml
:
"application/xml, text/xml"
,
html
:
"text/html"
,
...
...
@@ -695,6 +686,27 @@ jQuery.extend( jQuery.ajax, {
});
/*
* Create the request object; Microsoft failed to properly
* implement the XMLHttpRequest in IE7 (can't request local files),
* so we use the ActiveXObject when it is available
* Additionally XMLHttpRequest can be disabled in IE7/IE8 so
* we need a fallback.
*/
if
(
window
.
ActiveXObject
)
{
jQuery
.
ajaxSettings
.
xhr
=
function
()
{
if
(
window
.
location
.
protocol
!==
"file:"
)
{
try
{
return
new
window
.
XMLHttpRequest
();
}
catch
(
e
)
{}
}
try
{
return
new
window
.
ActiveXObject
(
"Microsoft.XMLHTTP"
);
}
catch
(
e
)
{}
};
}
// Does this browser support XHR requests?
jQuery
.
support
.
ajax
=
!!
jQuery
.
ajaxSettings
.
xhr
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment