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 9298123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T22:14:40+00:00 2026-06-18T22:14:40+00:00

How to detect if the server shut down during the client has visited a

  • 0

How to detect if the server shut down during the client has visited a page with javascript?

A request with a forever keep-alive header could do it, but the problem is that fires even when the user navigates away from the page.

  • 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-18T22:14:41+00:00Added an answer on June 18, 2026 at 10:14 pm

    Perhaps this is a bit of a naive approach, but you could count the number of response headers when an ajax call fails. With jQuery, for instance, you could do this:

    $.ajax( {
        'url': urlToTheServer,
        'success': function()
        {
            // server is up
        },
        'error': function( $xhr )
        {
            if( $xhr.getAllResponseHeaders().length < 1 )
            {
                // fair probability server is down
            }
        }
    } );
    

    The way I tested this, on my development box, is wrap the above in a setTimeout() call (with say, a 10 sec. timeout). Load the page. Shutdown server. And then wait for the timeout to expire and do the ajax request.

    PS.: $xhr.getAllResponseHeaders() returns a newline delimited string of headers, not an array or object of headers. I overlooked this at first, however, this doesn’t change the outcome of the script. If the string length of $xhr.getAllResponseHeaders() is less than 1, no response headers were present.

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

Sidebar

Related Questions

How can I detect that a client has disconnected from my server? I have
How can WCF client detect that server requires security certificate? The detection should happen
How can I detect server-side (c#, asp.net mvc) if the loaded page is within
How could a client detect if a server is using Search Engine Optimizing techniques
How can a client detect if a server is using mod_rewrite? Now I know
I'm writing a client-server application where client should be able to automatically detect server
In Microsoft SQL Server, is there a way to detect whether a database has
I need to detect information about the Application Server my EJBs are running in.
I have a store with items retrieved from server. I would like to detect
I detect if a user has chrome frame by placing this in teh body

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.