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

  • Home
  • SEARCH
  • 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 1090933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:26:47+00:00 2026-05-16T23:26:47+00:00

Starting from Ameer Dawood ideea of ping from JS ( pinger ), I’ve got

  • 0

Starting from Ameer Dawood ideea of ping from JS ( pinger ), I’ve got a problem when the remote IP is a http server, and request HTTP authentification, the browser pop’s up the box for user/password. How can I avoid this, If the remote server request auth, we know that the remote server is responding and I need to call alive() function ( doesn’t work with http://someBogusUser:someBogusPass@ + ip, beacause it request the password again, I do not want to have the corect password saved on a client side script 🙂 )
The main part of the code is this:

img = new Image();
img.onload = function() { alive()();};
img.onerror = function() { unreachable()();};

img.src = "http://" + ip;
setTimeout(function() { unreachable();}, 1500);

Curently I’m trying to test if I can use a xmlhttprequest readyState and status to see if the remote IP is responding.
Anyone has an ideea on how to do this, or has knowledge of another method to test if a IP is alive from JS. Please don’t give me server side solutions (I’m using them now + AJAX).

Thank you

EDIT:
I think Web workers will stop any authentication popup from reaching the browser, but they can’t handle DOM events (onload, onerror) so workers can’t help … 🙁

  • 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-05-16T23:26:48+00:00Added an answer on May 16, 2026 at 11:26 pm

    I don’t think you can avoid it.

    This hack is not ‘ping’ in any normal sense of the word; it won’t “check an IP is alive”. It’s an HTTP request and subject to authentication, redirection and other facets of HTTP. (And of course it won’t ‘ping’ a machine that’s not running an HTTP server.) Any method of remote inclusion (img, script, style, iframe) risks popping up authentication.

    With XMLHttpRequest you will have problems because of the Same Origin Policy. IE and Opera will immediately fail any attempt with a security error. Firefox and WebKit will try to make the connection though you won’t get anything usable as a response so you’ll have to continue to guess from the timeout length. Which itself seems pretty problematic to me. Certainly it’s not out of bounds to expect the / page of any given website to take more than 1.5s to return a complete document.

    In short I don’t think ‘pinger’ is viable as anything other than a fun experiment. For any real work you will have to continue with the server-side ping.

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

Sidebar

Related Questions

Starting from Android 3.2 I have this strange problem. It's very easy to reproduce:
Edit: I fixed the problem by just starting from scratch. Sorry to waste y'alls
Starting from an Html input like this: <p> <a href=http://www.foo.com>this if foo</a> <a href=http://www.bar.com>this
Starting from an Html input like this: <p> <a href=http://www.foo.com>this if foo</a> <a href=http://www.bar.com>this
Starting from this example: http://support.microsoft.com/kb/828736 I have tried to add a test function in
Starting from Windows Server 2003, Windows included a new tool which calculates the effective
i have this problem: starting from an empty list (0 elements) i want check
starting from this point: http://www.mattakis.com/blog/kisg/20090708/broadcasting-video-with-android-without-writing-to-the-file-system I'm trying to create an application to save a
Hi I'm starting from http://matplotlib.sourceforge.net/users/path_tutorial.html . I'm looking a function to get all bezier
Starting from a totally empty MXML application: <?xml version=1.0 encoding=utf-8?> <mx:Application xmlns:mx=http://www.adobe.com/2006/mxml layout=absolute >

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.