#_=_ 由 facebook 添加到 URL [英] #_=_ added to URL by facebook

查看:27
本文介绍了#_=_ 由 facebook 添加到 URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过 Facebook 连接到我的 Rails 应用后,我在我的 URL 中添加了 #_=_.

After connecting to my Rails app via Facebook I have #_=_ added on to my URL.

我尝试指定 FB 指定的 redirect_uri,但没有用.
删除符号的 Javascript 解决方法无济于事.我尝试了一切都没有结果.
有关如何解决此问题的任何指示?

I tried specifying a redirect_uri as specified by FB but it didn't work.
Javascript workaround to remove the symbols doesn't help. I tried everything with no results.
Any pointers on how to solve this?

我的设置:

gem 'rails', '3.0.11'
gem "devise", '1.5.2'
gem "omniauth", '1.0.1'
gem 'omniauth-facebook', '1.0.0rc2'

module Facebook
 CONFIG = YAML.load_file(Rails.root.join("config/facebook.yml"))[Rails.env]
 FB_APP_ID = CONFIG['app_id']
 FB_APP_SECRET = CONFIG['secret_key']
end

Rails.application.config.middleware.use OmniAuth::Builder do    
 provider :facebook, Facebook::FB_APP_ID, Facebook::FB_APP_SECRET,
 :scope => 'offline_access, email, publish_stream',
 :display => 'touch'
end

推荐答案

Facebook 有意添加了 #_=_ 片段,如 会话重定向行为的变化.据称,在您的请求中显式设置 redirect_uri 可以解决这个问题,但显然存在一个错误,即使指定了 redirect_uri 后,不需要的片段仍然存在.

The #_=_ fragment is being intentionally added by Facebook as described under Change in Sessions Redirect Behavior. Explicitly setting the redirect_uri in your request allegedly takes care of this problem, but there's apparently a bug that persists the unwanted fragment even when the redirect_uri is specified.

假设此错误未解决,解决方法可能是使用 Javascript 替换哈希位置:

Assuming this bug isn't resolved, a workaround may be to replace the hash location using Javascript:

window.location.hash = ""

这不会替换实际的哈希字符,但会删除它后面的所有内容.

This doesn't replace the actual hash character, but will get rid of everything following it.

这篇关于#_=_ 由 facebook 添加到 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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