I get this error “FB is not defined” when i try to run this code in Internet Explorer:
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
var accessToken = response.authResponse.accessToken;
var uid = response.authResponse.userID;
share(accessToken,uid);
} else {
FB.login(function(response) {
if (response.authResponse) {
FB.api('/me', function(user) {
var uid = user.id;
var name = user.name;
var email = user.email;
var gender = user.gender;
var birthday = user.birthday;
var username = user.username;
var link = user.link;
});
} else {
alert('Du skal acceptere');
}
}, {scope: 'email', display: 'iframe'});
}
});
Anyone have any idea how I can fix this. It’s working in every other browser than Internet Explorer 7&8
From the fiddle, the reason you cannot get it to work in IE7 and 8 is because of the trailing space in the comma separated list of
oauth : true,}in your FB.init(). Some browsers are forgiving of this syntax error, but others like IE are not. Fix the syntax issue and you should be fine.