Ajax: IE and Mozilla errors you need to know about

Source: Internet
Author: User
Document directory
  • Automation server can't create object
  • Ns_error_not_available
  • Error Handling
URL: http://radio.javaranch.com/pascarello/2006/02/07/1139345471027.html

Ajax: IE and Mozilla errors you need to know about

If you are logging clientside errors, your may see two errors show up with Ajax applications. the first error is with IE: "Automation server can't create object" and the second error was Mozilla: "ns_error_not_available ". now I will tell you what causes them.

Automation server can't create object

Well this error commonly will show up with ie6.0 in your logs. this is a really simple error to reproduce. set your security level to high and then enable Active Scripting (JavaScript ). run your application. if you get an error, that means you are not using try catches when you are setting the ActiveX object. so if you see this error you just need to add try catches around your declaration. basic example is below:

try{
this.req=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){

}
Ns_error_not_available

This error took a little investigation on my part. So I did a search on Bugzilla and came up with this link: https://bugzilla.mozilla.org/show_bug.cgi? Id = 238559 # C0

So you do not have to search through the whole page I posted the problem with Mozilla and why it causes the error:

<Quote from https://bugzilla.mozilla.org/show_bug.cgi? Id = 238559 # C0>

Mozilla calls onload() for all HTTP transactions that succeeded. The only
time it calls onerror() is when a network error happened. Inside the onerror
handler, accessing the status attribute results in this exception:

Error: [Exception... "Component returned failure code: 0x80040111
(NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult: "0x80040111
(NS_ERROR_NOT_AVAILABLE)" location: "JS frame ::
file:///Users/chuck/errtest.html :: anonymous :: line 114" data: no]
Source File: file:///Users/chuck/errtest.html
Line: 114

</Quote>

Now an easy fix for now is to add another try catch in your onerror function when you are reading the status property. this will stop the error occuring, but thanks to this, you will not have all of the information that you coshould have with IE.

Error Handling

On of the best things you can do is implement error handling on your clientside applications. logging them to the server can let you spot problems that you may never see. you may never new about these errors on your site if they never came up in testing. logging problems will allow you to see them. I am doing a talk on this at the Ajax experience in May.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.