我使用以下脚本为Facebook第三方登录:
<div id="fb-root"></div>
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript">
FB.init({
appId : '<?=$fbconfig['appid']?>',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
</script>
它适用于所有浏览器。但它在IE8中不起作用。请帮助我解决这个问题。
我已经用过这种异步方法很多次了,我想它可能会对某人有所帮助
<script>//initializing Facebook API
window.fbAsyncInit = function() {
FB.init({
appId : '<?=$fbconfig['appid']?>',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script><!-- login button --><a href="#" onclick="fblogin();return false;"><img src="images/my_login.png"></a><script>
//your fb login function
function fblogin() {
FB.login(function(response) {
// you script data
}, {scope:'read_stream,publish_stream,offline_access'});
}
</script>