I’m currently working on a mobile web application that utilizes the JavaScript Facebook-SDK. The web app operates over HTTP. I followed the instructions from JavaScript Facebook-SDK How-To to load and initialize the SDK.
The issue arises occasionally when I receive a warning stating "Failed to load resource: An SSL error has occurred and a secure connection to the server cannot be established." Additionally, there is a URL listed as "?..."
This problem only surfaces at times, leading to an Alert Box notification on my iPhone saying "[App-Name] could not be opened because it could not establish a secure connection to the server." when launching the web app from the home screen.
Does anyone have insights into why this error might be happening?
Here's the code snippet I use to load and initialize the SDK:
window.fbAsyncInit = function() {
FB._https = false;
FB.init({
appId : '[my app id]', // App ID
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
FB.Event.subscribe('auth.statusChange', handleStatusChange);
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));