DKB*_*HOI 6 javascript facebook-javascript-sdk facebook-opengraph facebook-stream-story custom-stories
我正在使用JavaScript sdk作为我的一个Facebook画布游戏应用程序.我正在尝试实现自定义故事共享对话框以在用户墙上发布故事.
开发人员网站上提供的信息不明确且有限.下面的代码用于使用open grap API共享自定义故事.Bellow代码可在Facebook开发者网站链接上获得(https://developers.facebook.com/docs/sharing/reference/share-dialog).Facebook提供的代码工作正常,因为它使用预定义的action_type.
FB.ui({
method: 'share_open_graph',
action_type: 'og.likes',
action_properties: JSON.stringify({
object:'https://developers.facebook.com/docs/',
})
}, function(response){});
Run Code Online (Sandbox Code Playgroud)
我在FB Developer控制台App的Open Graph选项卡上为自定义故事创建了一个对象(板球)和动作(播放).我创建了一个名为cricket.html的自托管对象(html页面).Bellow是内容或我的html页面.我验证了Open Graph Object Debugger.Graph Object Debugger上的html页面向我显示了所有信息,我给出的没有错误或警告.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta property="fb:app_id" content="*************" />
<meta property="og:type" content="appnamespace:cricket" />
<meta property="og:title" content="App for u" />
<meta property="og:url" content="https://example.com/appnamespace/cricket.html" />
<meta property="og:description" content="Find me on facebook for u" />
<meta property="og:image" content="https://example.com/appnamespace/image/any_time_share.png" />
</head>
<body>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
贝娄是我要替换的代码: - og.likes ---到---> appnamespace:play("play"是我的动作).
我在这里做错了吗?请告诉我.
function customshare()
{
FB.ui({
method: 'share_open_graph',
action_type: 'appnamespace:play',
action_properties: JSON.stringify(
{
object:'https://example.com/appnamespace/cricket.html',
})
},
function(response){});
}
Run Code Online (Sandbox Code Playgroud)
但是,我在执行FB.ui方法时收到以下错误:'share_open_graph'表示自定义共享.

我通过简单的改变解决了我的问题: -
object:'https://example.com/appnamespace/cricket.html',
Run Code Online (Sandbox Code Playgroud)
至
cricket:'https://example.com/appnamespace/cricket.html',
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4724 次 |
| 最近记录: |