I am currently working on implementing a Facebook login using the JavaScript SDK. Everything is functioning correctly in most browsers, but I am experiencing issues with certain versions of Internet Explorer.
The login functionality is not working on my local IE11, as well as on IE7 when testing on browserstack.com (although it does work on their IE11).
Below is the code snippet I am using:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title>Facebook Login JavaScript Example</title>
<meta charset="UTF-8">
</head>
<body>
<script>
// Load the SDK asynchronously
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'INSERT SOME APP ID',
cookie : true,
status : true,
xfbml : true,
version : 'v2.1'
});
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
alert('authorized');
} else if (response.status === 'not_authorized') {
alert('logged in but not authorized');
} else {
alert('logged off');
}
});
};
</script>
</body>
</html>
This code is mostly taken from the Facebook documentation. However, I am facing an issue where fbAsyncInit is not being called no matter what I try.
Thank you for your assistance.