单击“喜欢”时如何阻止粉丝门/喜欢门重定向到墙
我创建了一个 Facebook 粉丝页面,用作粉丝门/类似门。当用户单击“喜欢”按钮时,页面会重定向到墙。我想覆盖此行为并将页面重定向回粉丝门的“喜欢”版本。该应用程序是一个 iFrame 页面选项卡应用程序,使用 PHP 签名请求来确定喜欢/不喜欢的状态。
例如 http://www.facebook.com/1800flowers 当您喜欢该页面时,它会将您重定向到 http://www.facebook.com/1800flowers?sk =app_116748578401618
所以我的搜索找到了一段应该可以解决这个问题的JavaScript:
<script type="text/javascript">
if (top != self) top.window.location = 'linkgoeshere';
</script>
我尝试放置该 JavaScript 块位于页面的“喜欢”和“不喜欢”部分。无论哪种方式,它都会创建一个重定向循环,页面不断刷新。
如果此代码是答案,那么它应该位于哪里,以及“linkgoeshere”应该替换为什么?我可能使用了错误的链接。
如果这不是答案,还有其他选择吗?
I've created a Facebook fan page that works as a fan gate / like gate. When the user clicks the "Like" button the page redirects to the wall. I want to override this behavior and have the page redirect back to the Liked version of the fan gate. The app is an iFrame page tab app using the PHP signed request to determine liked/notliked status.
An example of this is http://www.facebook.com/1800flowers
When you like the page, it redirects you to http://www.facebook.com/1800flowers?sk=app_116748578401618
So my search-fu found a piece of JavaScript that was supposed to fix this:
<script type="text/javascript">
if (top != self) top.window.location = 'linkgoeshere';
</script>
I've tried placing this block of JavaScript in both the have liked and have not liked sections of the page. Either way it creates a redirect loop where the page just continually refreshes.
If this code is the answer, where should it be located, and what should "linkgoeshere" be replaced with? There is a possibility I've been using the wrong link.
If this isn't the answer, is there an alternative?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这是目前 Facebook 上的一个错误,描述如下 - https://developers.facebook.com/bugs/110015112440103
如果能有一个临时修复就太好了,但由于“Like”按钮的代码不在页面选项卡可访问的范围内,所以我无法想象解决方案可能是什么样子,无法从页面中删除地址以使其不再是“位置”,而“位置”似乎是唯一受影响的页面。
This is a bug on facebook right now, described here - https://developers.facebook.com/bugs/110015112440103
It'd be great to have an interim fix but since the code for the Like button is outside of what's accessible to the page tab, I'm having trouble imaging what a solution might look like, short of removing the address from your page to make it not a "place", which seem to be the only pages affected.
这几天我一直遇到这个问题,但今天我找到了解决方案。您的怀疑是正确的,这是由页面上新的推荐对话框引起的。此框仅出现在“地点”页面上。如果您的页面分配了地址,请将其删除,您的 fangate 将在点赞时重新加载到窗口中,而不是重定向到墙页。
I've been having this problem for the past few days, but today I found the solution. You were right with your suspicions that this is caused by the new recommend dialog box on pages. This box only appears on pages for PLACES. If you have a address assigned to your page then remove it and your fangate will reload in the window when liked and not redirect to the wallpage.
你不应该需要任何 JavaScript。
确保您在管理页面的“管理权限”部分将“默认登陆选项卡”设置为您的扇门。
You shouldn't need any JavaScript.
Makes sure you set the "Default Landing Tab" to be your fan gate in the "Manage Permissions" section of the page Admin.
这是我使用的解决方案。另外,请确保按照上面标记设置默认登陆选项卡。您需要下载适用于 php 的最新 facebook sdk,并将您的应用程序 ID、应用程序密钥和粉丝专页路径替换为下面的 $loginNextPage。
请注意,您可以在两个位置添加自己的 HTML 或包含应为适当受众提供的页面内容。
此外,无论您将什么设置为默认选项卡,喜欢您页面的回访用户总是会默认看到墙。因此,如果他们离开并回来,他们就会得到隔离墙。
Here is the solution I use. Also, be sure as marked above to set the default landing tab. You will need to download the latest facebook sdk for php, and replace the lines for your app ID, app secret, and the path to your fanpage int he $loginNextPage below.
Notice that there are two places where you can add your own HTML or an include of the page content that should be served for the appropriate audiences.
Also, returning users who liked you pages always get the wall by default, no matter what you set as the default tab. So if they leave and come back, they will get the wall.