FB.ui“提要对话框” - 对话框不适用于冗长的“描述”财产
我正在使用 Javascript SDK 为 iFrame 中的 Facebook 页面生成提要对话框:
这是调用“提要”对话框的代码:
function clickShare(){
/* 400 char long string used for the description property */
var shareDescription = 'Lorem ipsum dolor sit amet consectetuer adipiscing elit sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat vel illum dolore eu feugiat nulla faci';
var publish = {
method: 'feed',
name: 'TITLE GOES HERE',
caption: 'CAPTION GOES HERE',
description: shareDescription,
link: 'link back to page',
picture: 'image.jpg'
};
FB.ui(publish);
}
它似乎在 Windows 中的所有浏览器中都能正常工作,冗长的描述在视觉上很直观被截断,但对话框有一个“显示更多”,可以扩展为完整的描述。
不幸的是,当我尝试在 Mac 计算机上的任何浏览器中使用此功能时,对话框开始显示,但根本不显示任何内容。它只是永远挂在一个空的白色对话框上。
但是,当我将字符串截断为 230 个字符的长度时,该对话框开始在 Mac 浏览器上运行。
例如,我在将 JS 中的字符串发送到 FB 以进行对话框弹出之前将其截断:
shareDescription = shareDescription.substr(0, 230) + "...";
有人知道 Mac 浏览器中使用 Facebook 或一般情况下存在某种 JSON 字符长度限制吗?
感谢您的帮助!
I'm using the Javascript SDK to generate a feed dialog box for a Facebook page that's in an iFrame:
Here's the code that calls the "feed" dialog box:
function clickShare(){
/* 400 char long string used for the description property */
var shareDescription = 'Lorem ipsum dolor sit amet consectetuer adipiscing elit sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat vel illum dolore eu feugiat nulla faci';
var publish = {
method: 'feed',
name: 'TITLE GOES HERE',
caption: 'CAPTION GOES HERE',
description: shareDescription,
link: 'link back to page',
picture: 'image.jpg'
};
FB.ui(publish);
}
It seems to work fine in all browsers in Windows, the lengthy description gets visually truncated but the dialog box has a "show more" that expands to the full description.
Unfortunately, when I try to use this in any browser on a Mac computer the dialog box begins to show, but never displays anything in at all. It simply hangs on an empty, white dialog box forever.
But when I truncate the string to a length of 230 characters, the dialog box begins to work on Mac browsers.
For example, I truncate the string in JS before it gets sent to FB for the dialog popup:
shareDescription = shareDescription.substr(0, 230) + "...";
Is anyone aware of some sort of JSON character length limitation that occurs in Mac browsers with Facebook or just in general?
Thanks for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论