如何从Facebook页面标签页的内部页面分享内容? [英] How do I share content from a Facebook Page Tab's internal page?

查看:184
本文介绍了如何从Facebook页面标签页的内部页面分享内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试分享页面标签页的内部页面上的内容。此页面上的每个项目都有一个Like按钮,我想将用户重定向到该页面,并通过JS滚动到该项目。最好不要透露网站的真实网址。换句话说,要分享如下内容: https:// www .facebook.com / pages / PAGENAME / PAGENUMBER?sk = app_PAGETABNUMBER& app_data = 5



问题是当我尝试分享上面的URL,Facebook不考虑OG标签。有什么建议么?谢谢!



编辑1:当我在Debugger上放置一个像上面那样的URL,它说这个Debugger不能删除Facebook的URL,所以我猜这个不能找到og标签。编辑2:如果我将网站的真实网址放在Like按钮的数据href中,并且在初始页面选项卡页面中,我将app_data做一个重定向到具有og标签的内部页面(其中og:url指向上述URL),Facebook忽略了og标签。在调试器中,它说解析输入URL时出错,没有数据被删除。



编辑3:只能通过共享真实网站的URL来实现。当用户访问链接时,我将其重定向到上面的URL。如果用户代理名称中有Facebook,我既不加载PHP SDK也不加载重定向,以便检索og标签。

解决方案

这不是在url中传递变量的正确方法,你需要像这样在app_data中传递像对象这样的Json

  https://www.facebook.com/pages/PAGENAME/PAGENUMBER?sk=app_PAGETABNUMBER&app_data= {Redirect_Page:Home.aspx} 

I'm trying to share content that is on a Page Tab's internal page. Each item on this page has a Like button and I'd like to redirect the user to the page and scroll via JS to the item. Preferably, I'd like to not disclose the site's real url. In other words, to share something like this: https://www.facebook.com/pages/PAGENAME/PAGENUMBER?sk=app_PAGETABNUMBER&app_data=5

The problem is when I try to share the url above, Facebook doesn't take into account the OG tags. Any suggestions? Thanks!

Edit 1: when I put an url like the one above on Debugger, it says "Facebook URLs aren't scrapable by this Debugger", so I guess it isn't able to find the og tags.

Edit 2: if I put the site's real url in the data-href of the Like button and in the initial Page Tab page I get the app_data to do a redirect to the internal page with the og tags (where og:url points to the url mentioned above), Facebook ignores the og tags. In the Debugger, it says "Error parsing input URL, no data was scraped."

Edit 3: could only get it to work by sharing the real site's url. When a user visits the link, I redirect him to the url above. If the user agent has facebook in its name, I neither load the PHP SDK nor do the redirect, in order to let it retrieve the og tags.

解决方案

This is not the right way to pass variable in url, you need to pass Json like object in app_data like this

https://www.facebook.com/pages/PAGENAME/PAGENUMBER?sk=app_PAGETABNUMBER&app_data={"Redirect_Page":"Home.aspx"}

You can then get the app_data in signed request once you parse app_data as Json object you can access app_data["Redirect_Page"].

这篇关于如何从Facebook页面标签页的内部页面分享内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆