Jump to content

New JavaScript Error


cmattoon

Recommended Posts

Hi all,

I recently put a live search box on a website, and it was working fine for the past few weeks. Suddenly, I receive the following error when the page is accessed via a link (after it's accessed, 'refresh' cures the problem) - but I'm not sure why it's showing up suddenly. The search box does not work when the error is shown.

 

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MDDC; .NET4.0C; InfoPath.3; Zune 4.0)
Timestamp: Sat, 22 Jan 2011 12:39:58 UTC


Message: Object doesn't support this property or method
Line: 3
Char: 3
Code: 0
URI: http://wwww....com/ajax_search.js

 

Lines 1-9 of "ajax_search.js":

function getXmlHttpRequestObject() {
if (window.XMLHttpRequest) {
	return new XMLHttpRequest();	
} else if(window.ActiveXObject) {
	return new ActiveXObject("Microsoft.XMLHTTP");	
} else {
	alert("Your Browser Sucks!");	
}
}

 

I've tried deleting the whitespace and replacing it, in hopes that character 3 was an invalid 'invisible' character, but that didn't work. I also uploaded the backup copy, in case it was the other guy who messed it up (which I doubt, since neither of us touch JS files that are working...purely for this reason..)

 

Any thoughts?

 

Thanks!

Link to comment
Share on other sites

You could use the IE8 developer tools te debug: press F12 -> script tab -> debugging option.

 

So apparently it trips over the XMLHttpRequest object? Try:

 

function createXMLHttpRequest() {
  var myXMLObject = false;
  if (window.XMLHttpRequest) {
   myXMLObject = new XMLHttpRequest();
  } else if(window.ActiveXObject) {
   try {
    myXMLObject = new ActiveXObject("Msxml2.XMLHTTP");
   } catch (e) {
    try {
     myXMLObject = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {
     myXMLObject = false;
    }
   }
  }
  return myXMLObject;
};

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.