Ticket #6298 (closed bug: fixed)
IE7,IE8 throw exception on new window.XMLHttpRequest();
| Reported by: | name5566 | Owned by: | john |
|---|---|---|---|
| Priority: | high | Milestone: | 1.4.3 |
| Component: | ajax | Version: | 1.4.2 |
| Keywords: | IE7,IE8,xhr,XMLHttpRequest exception | Cc: | |
| Blocking: | Blocked by: |
Description
Microsoft failed to properly implement the XMLHttpRequest in IE7 and IE8.
Test Case: <!DOCTYPE HTML PUBLIC "-W3CDTD HTML 4.01 TransitionalEN" " http://www.w3.org/TR/html4/loose.dtd"> <html>
<head>
<script src="js/jquery/jquery-1.4.2.js" type="text/javascript" charset="utf-8"></script> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>index.html</title> <script type="text/javascript" charset="utf-8">
$(function() {
$('a').click(function() {
$('div').load('register.html'); return false;
});
});
</script>
</head> <body>
<div></div> <a href="register.html">Here</a>
</body>
</html>
Open the IE8 or IE7 and then click the link(register.html) if you open the page, don't reload the page, and click the link at the first time.
IE7 window.XMLHttpRequest will throw a exception: Permission Denied IE8 window.XMLHttpRequest will throw a exception: Object don't support this property or method
if you reload the page, and click, on exception throw.
I try to fix it: xhr:function() { return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(); },
it be well.
Attachments
Change History
Changed 3 years ago by name5566
-
attachment
index.html
added
comment:2 Changed 3 years ago by dmethvin
Note that the user (or in a company, the admin with the IEAK) has the ability to disable the "native" XMLHttpRequest object introduced starting in IE7. If you are encountering situations where the native object no longer works, check IE Tools, Internet Options, Advanced, Security, "Enable native XMLHTTP support."
There doesn't appear to be any way to tell when XHR has been disabled, and the document.XMLHttpRequest check still succeeds in IE even though it's disabled.
comment:3 Changed 3 years ago by snover
- need changed from Patch to Commit
- Owner set to john
- Priority set to undecided
comment:4 Changed 3 years ago by snover
- Priority changed from undecided to high
#6728 is a duplicate of this bug.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

use case