use*_*687 0 javascript facebook
我有一个小应用程序.页面加载时会显示"未定义".为什么这样,我该如何解决这个问题呢?
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title>Facebook Stream Publish PHP example</title>
<script src="//connect.facebook.net/en_US/all.js"></script>
</head>
<body><div id="fb_root"></div>
<script type="text/javascript">
FB.init({appId: 'appid', status: true, cookie: true, xfbml: true});
var body = 'Reading JS SDK documentation';
FB.api('/me', 'post', { message: body }, function(response) {alert(response.length);
if (!response || response.error) {
alert('Error occured '+response.error+" "+response);
} else {
alert('Post ID: ' + response.id);
}
});
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
更改'appid'代码行:
FB.init ({appId: 'appid', status: true, cookie: true, XFBML: true});
Run Code Online (Sandbox Code Playgroud)
您在apps.facebook.com上注册的应用程序的ID
在以下网址注册申请后:https://developers.facebook.com/
您的申请中包含以下信息:
Summary
App ID / API Key
223437354380201
Secret App
344573e468de5de3a10b66e0704b8083
Run Code Online (Sandbox Code Playgroud)
将"appid"替换为"App ID/API Key"的数量,在本例中为"223437354380201"
| 归档时间: |
|
| 查看次数: |
2044 次 |
| 最近记录: |