SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    Toronto, Canada
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Check if a website is available?

    How can I check if a website (like www.example.com ) is available/connectable and if it is, then automatically redirect to there? Otherwise if not, then don't do anything?

    Thanks!

  2. #2
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I honestly dont think thats possible in javascript because it requires a request / response from the server... with a server-side language you can

    BUT you know now that Im thinking more about it you MIGHT be able to do it with XMLHttpRequest ....... Ill have to think about that, might be possible after all....hmmmm

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    Toronto, Canada
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What about in Javascript where I connect to a .js script on another server and if that script returns a variable then I know that the server is alive?

  4. #4
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OH, do you have control of the other website? I assumed you meant some other site out there like cnn or something....

  5. #5
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    Toronto, Canada
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have control of both websites. I'm talking about 2 specific websites So, any ideas?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •