Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7963893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:43:58+00:00 2026-06-04T05:43:58+00:00

In a standalone XUL app, I’d like to catch the server not found exception.

  • 0

In a standalone XUL app, I’d like to catch the server not found exception. I’ve tried by checking state in onStateChange event of the nsIWebProgressListener, but this doesn’t seem to work. My onStateChange event implementation is as shown below. I’m making the assumption that if STATE_START or STATE_STOP is not returning a valid value, then there’s something wrong with page loading, and displays the error message to the user.

onStateChange: function(aProgress, aRequest, aFlag, aStatus) {
  const STATE_START = Components.interfaces.nsIWebProgressListener.STATE_START;
  const STATE_STOP = Components.interfaces.nsIWebProgressListener.STATE_STOP; 

  if(aFlag & STATE_START) {
      document.getElementById("progressBar").hidden = false;
  }
  if(aFlag & STATE_STOP) {
      setTimeout(function() { document.getElementById("progressBar").hidden = true; }, 2000);     
  }

  if(aFlag & (!STATE_START | !STATE_STOP)) {
    alert("Your connection seems to be down. Please confirm with your system admin.");    
  }
  return 0;

},

Can someone kindly advice me on what I’m doing wrong? Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T05:43:59+00:00Added an answer on June 4, 2026 at 5:43 am

    The onStateChange parameter indicating whether there was a connection error is aStatus. For example you could use Components.isSuccessCode:

    if ((aFlag & STATE_STOP) && !Components.isSuccessCode(aStatus))
    {
      alert("Your connection seems to be down. Please confirm with your system admin.");
    }
    

    You could also compare aStatus with Components.results.NS_ERROR_UNKNOWN_HOST which corresponds to the “Server not found” error. If the connection is down there could be a number of other errors however, e.g. NS_ERROR_CONNECTION_REFUSED (connection failed), NS_ERROR_UNKNOWN_PROXY_HOST (proxy not found), NS_ERROR_OFFLINE (attempt to connect while in offline state). You can find the complete list of network error codes in nsNetError.h.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a standalone WPF app with multi-language support. I've found some great resources
For a web app or a standalone server app, which would you recommend, and
I've developed a standalone XULRunner app which I'm using as a browser. I'm not
i am writing standalone java app for production monitoring. once it starts running the
I have a standalone launcher for jetty inside server directory. I have some jeytty
i have written a standalone connect 4 game. next i would like to be
I'm developing a standalone application that accesses a common database on a server. It
I am writing a XUL application following the default structure for standalone XUL apps
I have a standalone PHP web app which consists of several pages in a
for a Ruby standalone script what Rails like deployment features such as Gemfile /

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.