这个案子似乎令人难以置信。
我有两个版本的 fbml 页面来显示要邀请的用户列表。这两个页面返回相同的 html。唯一的区别是一个有一个像http://mydomain/user/myFriends这样的网址,另一个有一个网址http://mydomain/facebook/myFriends。
一个版本运行良好,而另一个版本在浏览器尝试从 facebook 获取 serverfbml 时卡住返回 404。这是在 IE 和 Firefox 中尝试的。
更奇怪的是,如果我使用 firefox firebug 调试器并单击获取 serverfbml 的 url 并要求它在单独的选项卡中加载它,我仍然会得到相同的行为。但我可以查看 Firefox 为两个页面加载的源代码,发现它是 INDENTICAL。
这是页面的html。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link type="text/css" rel="stylesheet" href="/css/common.css"/>
</head>
<body id="page-facebook" class="facebook page-facebook-showInviteFriends logged-in ">
<script type="text/javascript" src="/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="/js/common.js"></script>
<html xmlns:fb="http://www.facebook.com/2008/fbml">
<fb:serverFbml width="760" height="346" style="width: 760px; height: 346px;">
<script type="text/fbml">
<fb:fbml style="width: 324px; height: 346px;">
<fb:request-form
action=""
method="POST"
invite="true"
type="Sample Name"
content="<fb:req-choice url='' label='Join Now!'></fb:req-choice>
">
<fb:multi-friend-selector
condensed="true"
showborder="true"
actiontext="Invite your friends"
email_invite=false
import_external_friends=false
exclude_ids=""
unselected_rows="10"
selected_rows="3"
/>
<fb:request-form-submit import_external_friends="false" label="null" />
</fb:request-form>
</fb:fbml>
</script>
</fb:serverFbml>
</html>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '130456257111111',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
channelUrl : 'http://sample.foobar.com/static/html/channel.html'
});
};
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
</script>
<script type="text/javascript" src="/js/facebook.js"></script>
</body>
</html>