开发者

Facebook omniauth callback and #_

I use Rails 开发者_StackOverflow社区3.1, Devise and Omniauth.

The problem is that when facebook callbacks to my app the url ends with #_. Then when in the callback action I redirect to something - for example /after_signin the redirect results in /after_signin#_.

Any idea how to remove this anchor from the URL?

EDIT: It does not matter what I put in the callback function. Even simple redirect:

class Users::OmniauthCallbacksController < ApplicationController
  def facebook
    redirect_to "/after_callback"
  end
end

it would result in going to /after_callback#_

Even in normal controller if you go to /#_ and you have some redirect ther it would get redirected to the specified path with #_ appended at the end.

EDIT2: I just found out that it is the browser fault to preserve the anchor. So it has to be handled in the frontend side.


If you're confident that it's a browser issue, you can just use JavaScript to update the hash portion of the window's location object. Maybe something like this:

if (window.location.hash.search('#_') >= 0) {
    window.location.hash = '';
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜