how to get the locale of a facebook user clicking on a localised object's link?

♀尐吖头ヾ 提交于 2020-01-05 10:08:25

问题


I'm about to implement open graph localised objects.

I have configured the og:locale:alternate meta tags, and, when a Facebook crawler request comes in, the correct locale is returned. As a result, I have one object per product (like counter is not divided), and the texts are correctly displayed on the wall posts, according to the user's locale setting.

If I look my own share, I see some Facebook URL parameters appended to the URL, but if someone shares my post, even these parameters are removed, leaving only the canonical URL. The canonical URL however does not contain any locale/language parameters, as these should be defined only by the og:locale tags which is OK for the posts.

But the problem is, that I am unable to find out the current user's locale (the person who actually clicked on the link) from these links.

I'm stuck here, because there's no locale, nor fb_locale parameters in the URL, nor the X-Facebook-locale header is sent. My app runs on an external site (not in canvas or tab) so the PHP SDK's getUser() and getSignedRequest() are not working either. I only have a Facebook cookie named locale.

Shouldn't Facebook append at least a locale/fb_locale parameter to the URL in this case? Since I only need the locale (which is, I think, completely harmless), I don't want to ask the first-time visitors for their permission to only get their locale. That would be, in fact ridiculous, as they are following a link that they already had in their language.

I don't have any idea to solve this issue. Thanks in advance if you have any ideas.

来源:https://stackoverflow.com/questions/14956375/how-to-get-the-locale-of-a-facebook-user-clicking-on-a-localised-objects-link

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!