Ajax:ie and Mozilla Errors you are need to know about

Source: Internet
Author: User
Tags error handling try catch

If you are are logging clientside errors, your May is two errors show up with Ajax applications. The the "the" the "Automation server can ' t create object" and "the second error was Mozilla:" Ns_error_not_availa BLE ". Now I'll tell you what causes them. Automation server can ' t create object

This is the error commonly would show the up and 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 a error, that means your are not using try catches when you are setting the ActiveX object. So if you are 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 the my part. So I did a search in Bugzilla and came up with this link:https://bugzilla.mozilla.org/show_bug.cgi?id=238559#c0

So did 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 () was when a network error happened. Inside The OnError
handler, accessing the status 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 ' easy ' fix for ' is ' to ' add another try catch in your onerror function while you are reading the Status property. This would stop the error occuring, but to this, and you won't be have all of the information so could have with I E. Error Handling

On the best things can be implement error handling on your clientside applications. Logging them to the "server can let you spot problems," may never. You may never new about this errors on your site if they never the up in came. Logging problems'll allow you to the them. I am doing a talk on this at the Ajax experience.



Eric Pascarello
Coauthor of Ajax in Action
Moderator of Html/javascript at www.JavaRanch.com
Author of:JavaScript:Your Visual Blueprint for Dynamic Web Pages trackbacks[0] comments[10] Posted from Pascarello on Febr Uary 7, 2006 3:51:11 PM EST
Reply | Permalink Re:Ajax:IE and Mozilla Errors you need to know about Hi Eric, I read your interview about security issues with Ajax. I share your view that overloading client JavaScript not only slows down response, but could expose a major part of Presenta tion & business logic to outside. We implemented an AJAX catalog where all business and presentation logic on the server. The Client JavaScript is standard to any form, control, event or value. It simply executes presentation directives contained in server ' s responses. I suggest you to quote this application during the Ajax Experience Conference. Thierry Nivelet Comment from Thierry nivelet on February 8, 2006 4:33:10 AM EST Reply | Permalink Re:Ajax:IE and Mozilla Errors you need to know about Hi Eric, I noticed a difference between IE and Mozilla WI Th InnerHTML. It looks like InnerHTML content length are limited in Mozilla. On my AJAX catalogue, when clicking a product button like "Eclairage", we come up with a DIVFilled with HTML provided by the Server:displays OK with IE, truncated with Mozilla. Thierry Nivelet Comment from Thierry nivelet on February 8, 2006 4:37:46 AM EST Reply | Permalink Re:Ajax:IE and Mozilla Errors you need to know about a reply 1 year later:) Hi Eric, I noticed a difference between IE and Mozilla with InnerHTML. It looks like InnerHTML content length are limited in Mozilla. The problem with Mozilla seems is on InnerHTML, but accessing XML DOM element ' s contents. I ' ve resolved the problem by not using XML as response, but a plain/text reply, and using. ResponseText instead of getting a n elements contents from. responsexml-fact I ' ve had other information than the HTML data that I should transmit, And I ' ve used JSON for both other data and the HTML string. Comment from Kerem Hadimli on February 2007 3:26:11 PM EST Reply | Permalink Re:Ajax:IE and Mozilla Errors you need to know about Hey Eric, I have the error in Firefox, but I don ' t unders Tand yourSolution (because I ' m not so smart I ques ...). Can you maybe explain a little about what code I should add or remove. I don ' t have a onerror function or I didn ' t made it. And what is a ' try Catch '? I would be verry thankfull if your could explain some of this to me! Bye, Rik Comment from Rik on April-2006 7:50:23 AM EST Reply | Permalink Re:Ajax:IE and Mozilla Errors you need to know about Basic idea:

 var status = "";
    try{status = Yourxhrvariable.statustext;

catch (e) {status = "trouble accessing It";} 
Eric Comment from Eric Pascarello on April, 2006 9:18:44 AM EST Reply | Permalink Re:Ajax:IE and Mozilla Errors you need to know about cool! IT Works! A lot! Comment from Anonymous on June 2006 2:28:19 PM EST Reply | Permalink Re:Ajax:IE and Mozilla Errors you are need to know about What does about this error: (ns_error_not_initialize D) [Nsixmlhttprequest.send] This happens whenever I put a timeout on the Ajax Timeoutid = settimeout (function () {if (ca Llinprogress (http)) {http.abort (); return false;//alert ("timedout");},//Five seconds); Yes purposely just to "response Comment from Anonymous on October, 2006 5:21:00 AM EST Reply | Permalink Re:Ajax:IE and Mozilla Errors you need to know about Hello, I am developing a Web page which contain a D a checkbox. Now, the slider the Btnclick is called in JavaScript onchange function of the slider. After moving the slider I click the checkbox it calls it Selectedindexchanged function. The Check box is in UpdatePanel. Now the problem occurs I-I-click the check box it works fine but the "I move" slider it does not CA LLS the Btnclick. This is problem occues in FireFox and NETSACPE. In IE it works fine. In the "Error consol I get" following error message error: [Exception ... "Component returned failure code:0x80040111 (ns_error_not_available) [Nsixmlhttprequest.status]" Nsresult: " 0x80040111 (ns_error_not_available) "Location:" JS frame:: http://localhost:4749/User/ScriptResource.axd?d= Thqt-opwnlri7os_oyosdakzdzf7ngbw_in5s3vz7nss8drfixqghepcxwrrecsunndctixaj80aoilykep-el0s8zicfqer3cw1q4qzioe1 &t=633029062313675 134:: Sys$net$xmlhttpexecutor$get_statuscode:: Line 4285 "Data:no] Source File:http://localhos T:4749/user/scriptresource.axd?d=thqt-opwnlri7os_oyosdakzdzf7ngbw_ in5s3vz7nss8drfixqghepcxwrrecsunndctixaj80aoilykep-el0s8zicfqer3cw1q4qzioe1&t=633029062313675 134 line:4285 On line 4285 there in no JavaScript error. Is this a bug in FireFox??? Comment from Deepesh on April 5, 2007 8:50:56 AM EST Reply | Permalink Re:Ajax:IE and Mozilla Errors you need to know about a lot! Comment from Kevinin on April 2007 9:44:30 AM EST Reply | Permalink Re:Ajax:IE and Mozilla Errors you need to know about to fix this problem, try making a settimeout (Functionstha Tmakestheajaxsend (), 500); Adjust the time as your like. Good luck Comment from Gonxalo to May, 2007 9:38:08 AM EST

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.