嗨,兄弟们可以帮我上载游戏时出现此问题,游戏必须通过CDN引用我们支持的SDK之一。 我真的需要了解为什么会发生这种情况,因此,如果您能尽快帮助我,我将非常感谢
FB.init({appId: '1039135876270670',
status: true, // Check login status
cookie: true, // Enables cookies so server can access the session
xfbml: true // Parse XFBML});
var pos = 0, test, test_status, question, choice, choices, chA, chB, chC,chD, correct = 0;
var questions = [
[ "What is 10 + 4?", "12", "14", "16","20", "B" ],
[ "What is 20 - 9?", "7", "13", "11", "5","C" ],
[ "What is 7 x 3?", "21", "24", "25", "27","A" ],
[ "What is 8 / 2?", "10", "2", "4", "6","C" ]
];
function _(x){
return document.getElementById(x);
}
function renderQuestion(){
test = _("test");
if(pos >= questions.length){
test.innerHTML = "<h2>Result<br> "+correct+" of "+questions.length+"</h2>";
_("test_status").innerHTML = "Test Completed";
pos = 0;
correct = 0;
return false;
}
_("test_status").innerHTML = "Question "+(pos+1)+" of "+questions.length;
question = questions[pos][0];
chA = questions[pos][1];
chB = questions[pos][2];
chC = questions[pos][3];
chD = questions[pos][4];
test.innerHTML = "<div class='q'>"+question+"</div>";
test.innerHTML += "<label><input type='radio' name='choices' value='A'class='rad' ><span>"+chA+"</span></label>";
test.innerHTML += "<label><input type='radio' name='choices' value='B'class='rad' ><span>"+chB+"</span></label>";
test.innerHTML += "<label><input type='radio' name='choices' value='C'class='rad' ><span>"+chC+"</span></label>";
test.innerHTML += "<label><input type='radio' name='choices' value='D'class='rad' ><span>"+chD+"</span></label>";
test.innerHTML += "<button class='btn' onclick='checkAnswer()'>Submit Answer</button>";
}
function checkAnswer(){
choices = document.getElementsByName("choices");
for(var i=0; i<choices.length; i++){
if(choices[i].checked){
choice = choices[i].value;
}
}
if(choice == questions[pos][5]){
correct++;
}
else
{
correct--;
}
pos++;
renderQuestion();
}
window.addEventListener("load", renderQuestion, false);
<pre>
<script src="http://connect.facebook.net/en_US/all.js" charset="utf-8"></script>
<h2 id="test_status"></h2>
<div id="test"></div>
</pre>
答案 0 :(得分:0)
您似乎正在使用Facebook Connect SDK。 Instant Games不支持Facebook Connect SDK,它们仅与Facebook Instant Games SDK一起使用。 Instant Games SDK不支持常规的Facebook登录,因为它们仅在Facebook中运行。
最好在这里阅读入门指南:https://developers.facebook.com/docs/games/instant-games/getting-started