 <p>Assuming FB is a variable containing the Facebook object, I'd try something like this:</p> <pre><code>if (typeof(FB) != 'undefined' &amp;&amp; FB != null ) { // run the app } else { // alert the user } </code></pre> <p>In order to test that something is undefined in plain old JavaScript, you should use the "typeof" operator. The sample you show where you just compare it to the string 'undefined' will evaluate to false unless your FB object really does contain the string 'undefined'!</p> <p>As an aside, you may wish to use various tools like Firebug (in Firefox) to see if you can work out why the Facebook file is not loading.</p>