这是m代码:
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
appId : '270423476xxxxx',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
</script>
<fb:registration
fields="name,birthday,gender,location,email"
redirect-uri="http://booktrolley.in/beta"
width="530">
现在,如果您转到我的页面:http://www.booktrolley.in/beta/fbreg.php
即使页面加载后,该“正在加载”动画仍会继续存在。为什么会这样?
谢谢
最佳答案
您正在将插件加载到框架中,但是页面的HTML结构不正确,这是一种更好的方法:
<html xmlns:fb="http://www.facebook.com/2008/fbml">
<head></head>
<body>
<div id="fb-root" > </div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script src="jquery.js"></script>
<script>
$(document).ready(function() {
var wid=$(document).width()-20;
$("#fb").attr('width',wid);
});
FB.init({
appId : 'XXXXXXXXXXX',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
</script>
<fb:registration redirect-uri="http://booktrolley.in/"
fields='[
{"name":"name"},
{"name":"foo","description":"Type foo","type":"text"},
{"name":"bar","description":"Type bar","type":"text"},
{"name":"facebooker","description":"Pick Paul","type":"select","options":
{"coder":"Paul","pm":"Austin","partners":"Cat"}},
{"name":"check","description":"Check this","type":"checkbox"},
{"name":"date","description":"Dec 16 2010","type":"date"},
{"name":"city","description":"Calgary","type":"typeahead","categories":
["city"]}]'
onvalidate="validate"></fb:registration>
<script>
function validate(form) {
errors = {};
if (form.foo !== "foo") {
errors.foo = "You didn't type foo";
}
if (form.bar !== "bar") {
errors.bar = "You didn't type bar";
}
if (form.facebooker !== "coder") {
errors.facebooker = "Pick the geeky one";
}
if (!form.check) {
errors.check = "Check the little box";
}
if (form.date !== '12/16/2010') {
errors.date = "That isn't the launch date";
}
if (form.city.id !== '111983945494775') {
errors.city = "That isn't Calgary, Alberta";
}
return errors;
}
</script>
</body>
</html>
关于javascript - Facebook JavaScript SDK意外行为,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7144761/