无法将命名锚点与 Facebook 选项卡链接一起使用
我尝试在 Facebook 选项卡的一部分上放置一个命名锚点,并将“#anchor”添加到共享 URL,这样当用户单击共享链接时,它将直接将他们带到选项卡上的正确内容。
我添加到我的选项卡,然后重新编码 FB Feed 对话框 URL,因此
link=http://www.facebook.com/mybhg?sk=app_279723102083145#quiz
在
actions={name:'name',link:'http://www.facebook.com/mybhg?sk=app_279723102083145#quiz'}
测试对话框时显示错误,指出这两个链接都是无效链接:
- 需要有效的重定向 URI
- 操作应该是包含“名称”和“链接”的 JSON 编码字典 所以我对 Facebook 接受的密钥
进行了 bit.lyd,您可以共享短 URL。当用户单击共享链接时,会使用正确的 URL(带有“#quiz”),但浏览器不会捕捉到锚点位置。
由于 FB 在原始 URL 上失败,我怀疑他们没有设置解析 URL 中的 #named 锚点,但我想将其发布到社区,看看是否有人让它工作(或确认它没有) 。)
谢谢!
I'm attempting to put a named anchor on a part of our Facebook tab and add "#anchor" to the shared URL so when users click the shared link it will take them directly to the proper content on the tab.
I added to my tab and then recoded the FB Feed Dialog URL so
link=http://www.facebook.com/mybhg?sk=app_279723102083145#quiz
and
actions={name:'name',link:'http://www.facebook.com/mybhg?sk=app_279723102083145#quiz'}
In testing the dialog displayed an error saying both of these were invalid links:
- Requires valid redirect URI
- actions should be a JSON-encoded dictionary with "name" and "link" keys
So I bit.ly'd them which Facebook accepted and you can share the short URL. When users click the shared link though, the correct URL is used (with "#quiz") but the browser does not snap to the anchor location.
Since FB failed on the original URL, I suspect they aren't set up to parse #named anchors in their URLs, but I wanted to put it out to the community and see if someone has made it work (or confirmed it doesn't.)
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
URL 片段(#)无法在服务器端读取。
您可以做的是使用
app_data
参数,该参数是在signed_request
参数上转发给您的,相应地解析它,并使用一些 Javascript 来强制自己跳转。URL fragments (the #) can't be read on the server side.
What you can do is use the
app_data
parameter, which is forwarded to you on thesigned_request
parameter, parse it accordingly, and have some Javascript to force the jump yourself.