SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jan 2014
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How can I check a website for a response from my local computer?

    I have a local webpage that I use to consolidate a bunch of information for my coworkers. I want to be able to use the webpage to check the response from different websites that I do not own with Firefox. All I want is to make sure the website is online and not down. Is there a way I can do that with Firefox without any extensions or server sided code?

    For example, if google is up then do something; if it is not then do something else.
    Code:
    $.ajax( "http://google.com" )
      .done(function() {
        alert( "success" );
      })
      .fail(function() {
        alert( "error" );
      })

  2. #2
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,938
    Mentioned
    214 Post(s)
    Tagged
    12 Thread(s)
    I don't think it'll be possible without server-side code, I'm afraid.

    If you could use server-side code then you could curl a service like downforeveryoneorjustme and parse the response.
    You could then use AJAX to find out if the page is up from your original page.

    Otherwise, your best bet might be to look at jQuery's $.ajax status codes, but I'm not suere how successful this might be.

    If you need any help with the curl solution, let me know.


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
  •