homepage Welcome to WebmasterWorld Guest from 54.205.193.39
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Object does not support error in IE7
object does not support error in IE7 , ajax
visu




msg:3224640
 9:44 am on Jan 19, 2007 (gmt 0)

This is the code i am using for ajax call... the code is working fine with all the lower version browsers 5.5 , 6 and giving object doesnot support error only in Internet explorer 7.. why? any one help me?...

The code follows
// JScript source code
<script>
function getXMLObj()
{
if (window.XMLHttpRequest)
{ // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType)
{
http_request.overrideMimeType('text/xml');
return(http_request);// See note below about this line
}
}
else if (window.ActiveXObject)
{ // IE
try
{
http_request = new ActiveXObject("Msxml2.XMLHTTP");
return(http_request);
}
catch (e)
{
try
{
http_request = new ActiveXObject("Microsoft.XMLHTTP");
return(http_request);
}
catch (e)
{alert("Your Browser settings not suitable");
}
}

}
}

var XMLObj;
function getCons()
{
XMLObj=new getXMLObj();
url="test.aspx";
XMLObj.onreadystatechange=loadItems;
XMLObj.open('GET',url,true);
XMLObj.send(null);

}
function loadItems()
{
if (XMLObj.readyState==4)
{

var obj=document.getElementById("myDIV");
obj.innerHTML=XMLObj.responseText;

}

}
</script>

 

daveVk




msg:3225563
 12:53 am on Jan 20, 2007 (gmt 0)

I am having similar problem, this link [blogs.msdn.com...] is relevent but seems to indicate your code is ok. Can you narrow problem to a particular line? My problem is getting responseXml, responseText is Ok and getResponseHeader("Content-Type") = text/xml and xml looks valid.

mrhoo




msg:3228139
 10:52 pm on Jan 22, 2007 (gmt 0)

Because IE7 does support window.XMLHttpRequest, but does not support
.overrideMimeType, so you are returning null from the function.

StupidScript




msg:3228170
 11:19 pm on Jan 22, 2007 (gmt 0)

overrideMimeType shouldn't come into play if it's not available, according to the script. Maybe your IE7 is having trouble getting the appropriate ActiveX object version? Here's what I use with no IE7 trouble:

var msxmlhttp = new Array(
'Msxml2.XMLHTTP.5.0',
'Msxml2.XMLHTTP.4.0',
'Msxml2.XMLHTTP.3.0',
'Msxml2.XMLHTTP',
'Microsoft.XMLHTTP');
for (i=0;i<msxmlhttp.length;i++) {
try {
thisConn = new ActiveXObject(msxmlhttp[i]);
} catch (e) {
thisConn = null;
}
}
if(!thisConn && typeof XMLHttpRequest!= "undefined") {
thisConn = new XMLHttpRequest();
}
if (!thisConn) {
thisConn = false;
}

Hope it's helpful.

mrhoo




msg:3228854
 4:32 pm on Jan 23, 2007 (gmt 0)

function getXMLObj() {
if (window.XMLHttpRequest){ // Mozilla, Safari,... &&IE7!
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType){ //Not in IE7
http_request.overrideMimeType('text/xml');
return(http_request);// See note below about this line
}
}
else if (window.ActiveXObject){

The above code finds window.XMLHttpRequest for IE,
and so it does not run the else to get an ActiveX object.

But there is no return value for a browser that does support
XMLHttpRequest but does not support overrideMimeType,
as in IE7.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved