如何检测 Facebook Javascript SDK 移动 iframe 的取消?
How to detect a cancel out of Facebook Javascript SDK's mobile iframe?
使用 Facebook Javascript SDK 版本 2.6 和新的 'mobile_iframe' 参数来共享内容(我认为这是一个新参数,我在 2.6 发布之前没有看到它,但它没有'出现在 FB 的更新日志中的任何地方)。该参数按照宣传的方式工作,除非用户在没有共享的情况下关闭对话框(即取消移动 iframe 弹出窗口),否则无法通过响应数据来辨别他们是否这样做了。
JS:
myJsClass.shareDetails = {
method: 'share',
href: shareURL
};
if (true === [on a mobile device]) {
myJsClass.shareDetails['mobile_iframe'] = true;
}
console.info('Share Data: ' + myJsClass.shareDetails )
FB.getLoginStatus( function( response ) {
if ( response.authResponse )
{
FB.ui( myJsClass.shareDetails,
function( response )
{
console.info('Response: 'response);
...
- 在移动设备上(使用移动 safari):
分享数据:{method: "share", href: "https://[my url is here]", mobile_iframe: true, version: "v2.6"}
-- 有效分享后:
响应:[]
-- 取消后:
响应:[]
- 在桌面浏览器上(使用 chrome):
-- 有效分享后:
响应:[]
-- 取消后:
响应:{error_code: 4201, error_message: "User canceled the Dialog flow"}
有没有办法确定取消mobile_iframe?
供参考:https://developers.facebook.com/docs/sharing/reference/share-dialog#mobile-web-share-dialog
事实证明这是一个有效的错误 - 已由 Facebook 确认:
https://developers.facebook.com/bugs/257808294557601
希望他们能尽快堵上这个洞。
使用 Facebook Javascript SDK 版本 2.6 和新的 'mobile_iframe' 参数来共享内容(我认为这是一个新参数,我在 2.6 发布之前没有看到它,但它没有'出现在 FB 的更新日志中的任何地方)。该参数按照宣传的方式工作,除非用户在没有共享的情况下关闭对话框(即取消移动 iframe 弹出窗口),否则无法通过响应数据来辨别他们是否这样做了。
JS:
myJsClass.shareDetails = {
method: 'share',
href: shareURL
};
if (true === [on a mobile device]) {
myJsClass.shareDetails['mobile_iframe'] = true;
}
console.info('Share Data: ' + myJsClass.shareDetails )
FB.getLoginStatus( function( response ) {
if ( response.authResponse )
{
FB.ui( myJsClass.shareDetails,
function( response )
{
console.info('Response: 'response);
...
- 在移动设备上(使用移动 safari): 分享数据:{method: "share", href: "https://[my url is here]", mobile_iframe: true, version: "v2.6"}
-- 有效分享后: 响应:[]
-- 取消后: 响应:[]
- 在桌面浏览器上(使用 chrome):
-- 有效分享后: 响应:[]
-- 取消后: 响应:{error_code: 4201, error_message: "User canceled the Dialog flow"}
有没有办法确定取消mobile_iframe? 供参考:https://developers.facebook.com/docs/sharing/reference/share-dialog#mobile-web-share-dialog
事实证明这是一个有效的错误 - 已由 Facebook 确认: https://developers.facebook.com/bugs/257808294557601
希望他们能尽快堵上这个洞。