Jump to content

Using JS to see if a site is online?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
phpforfun

phpforfun

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,236 posts
Hey, so let me explain myself. I have a small site thats being worked on, thats pretty much an online mp3 player with a thousand songs so far.
What I wanted to do was make it so the users can download a .html file that would open up and use JS to see if the site is online, if it is it would forward you to the site and ask you to login, if not it would display an error message.

has anyone tried this? How would I go about doing this.

#2
phpforfun

phpforfun

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,236 posts
By the way, the reason I want JS and not PHP, is because this code is going to be hosted on the .html file on the USERS computer, not my site, then it checks to see if my sites online, and then it forwards to my site...

#3
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
I suppose you can use XMLHttpResponse

#4
phpforfun

phpforfun

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,236 posts
XML? That would work I suppose, have you used that?

#5
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
I have. That function is the pretty much the only reason the AJAX technology exists. Although I have not used it to "ping" as site, I'm not sure how it would work if it doesn't receive a response from the URL.