脸书开放图

发布于 2024-12-28 21:00:08 字数 442 浏览 2 评论 0原文

问题,

我可以将打开的图形 url 留空,但动态地将 url 传递给按钮并使其正常运行吗?

该 URL 是动态的,并通过 ajax 根据页面上的用户交互进行更新。因此,如果我在 og 元中放置一个值,它将与实际页面 url(用户交互后)不同。

谢谢。

或者使用 FBML - 动态更新 fb:like 按钮是否存在任何问题,例如:

<script>
var fb_ps_page = window.location.href;
document.write('<fb:like href=" '+ fb_ps_page +'" send="false" layout="button_count" width="450" show_faces="false"></fb:like>');
</script>

Question,

Can I leave the open graph url blank, but dynamically pass the url to the button and have it function properly?

The url is dyanamic and updated by ajax from user interactions on the page. So if I put a value in the og meta, it will be different than the actual page url (after user interactions).

thanks.

or by using FBML - is there any issue updating the fb:like button dynamically like:

<script>
var fb_ps_page = window.location.href;
document.write('<fb:like href=" '+ fb_ps_page +'" send="false" layout="button_count" width="450" show_faces="false"></fb:like>');
</script>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云雾 2025-01-04 21:00:08

不,您无法动态更新“点赞”按钮的链接。您必须将其从 DOM 中删除并重新插入。然后调用 FB.XFBML.parse() 让 facebook 使用新的 url 渲染其 iframe。

No, you cannot dynamically update the link for the like button. You will have to remove it from the DOM and reinsert it. Then call FB.XFBML.parse() to get facebook to render their iframe with the new url.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文