SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard
    Join Date
    Jan 2005
    Location
    blahblahblah
    Posts
    1,447
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to make sure remote server is up and running?

    Hello,

    I'm building a very simple app that relies on a remote server. I will use this app on many websites, so I decided to store it on one server (I have control of the remote server in question).

    I need to make sure that this server is up and running, so in the case it's not I can use a fallback.

    Would it be a client-side approach? A server-side approach? My guess is to use a js snippet to do the job. If I'm correct, I'll probably use jquery to perfom the task.

    Regards,

    -jj.

  2. #2
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is your app like a javascript widget? Are you using any backend code?

    If it's just js, you can check the existence of something you create in your script to see if the code is there.

    (remote script)
    Code:
    var myObject = {};
    (local script)
    Code:
    if (typeof myObject !== 'undefined') {
    // do stuff
    } else {
    // fall back
    }


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
  •