Ajax: IE and Mozilla Errors you need to know about
2007-01-15 13:36
423 查看
URL:http://radio.javaranch.com/pascarello/2006/02/07/1139345471027.html
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>
</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 could have with IE.
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_***AILABLE". 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_***AILABLE
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#c0So 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_***AILABLE) [nsIXMLHttpRequest.status]" nsresult: "0x80040111 (NS_ERROR_NOT_***AILABLE)" 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 could 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.相关文章推荐
- Ajax: IE and Mozilla Errors you need to know about
- The 9 Deep Learning Papers You Need To Know About
- Everything you never wanted to know about kobjects, ksets, and ktypes
- 9 Useful PHP Functions and Features You Need to Know
- Everything You Need to Know about iOS and OS X Deprecated APIs
- Everything you need to know about automatic reference counting (ARC)
- Physical and Logical Block Corruptions. All you wanted to know about it. (Doc ID 840978.1)
- What is LineageOS ? Everything you need to know about Lineage OS
- Something you need to know about Content Deployment in SharePoint
- What you need to know about AllowUnsafeUpdates (Part 1) [转载]
- The 9 Deep Learning Papers You Need To Know About (Understanding CNNs Part 3)
- Everything You Need to Know About Rooting Your Android Phone
- What you need to know about transimpedance amplifiers – part 1
- (转)The 9 Deep Learning Papers You Need To Know About (Understanding CNNs Part 3)
- What you may need to know about DBTransaction::postChanges()
- What you need to know about AllowUnsafeUpdates (Part 2) [转载]
- Something you need to know about Objective-C and iOS programming: for experienced programmers
- WCF Essentials - What You Need To Know About One-Way Calls, Callbacks, And Events
- [转]What you need to know about transimpedance amplifiers – part 1
- All you need to know about SYN floods