8

When I try to login using Facebook Oauth all goes ok until the part the url redirects with something like this:

http://mywebsite.com/facebookoauthbackpage.php#_=_

I'm using jQuery Mobile on my pages and I think that #= is the problem.

The page stays blank and nothing happens. If I remove the "#=" all goes alright and the action happens normally.

Does anyone have any idea on how to fix that? I've notice that removing the "#=" from the Facebook will not be possible anymore, so maybe removing something from the jQuery mobile script may solve that with javascript, but I don't know how to do that.

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189

1 Answers1

17

You could try to forcefully remove the hash at the beginning of your html, something like

<script>
if (window.location.hash == "#_=_")
        window.location.hash = "";
</script>

Theoretically the routine will be called before $(document).ready :) (never tried it on jquery mobile though)

azureru
  • 646
  • 3
  • 9
  • Yea, this is basically the solution. Where on earth does the `_=_` come from? – maxl0rd Dec 01 '11 at 19:46
  • "This week, we started adding a fragment #_=_ to the redirect_uri when this field is left blank. Please ensure that your app can handle this behavior." --> https://developers.facebook.com/blog/post/552/ – azureru Jan 17 '12 at 18:30
  • This works great, been searching for a solution to this all day - Caio you should approve the answer unless anyone else has a better idea. – MBHNYC Apr 28 '12 at 13:59
  • placing the code before document load, worked for me too. Caio should accept the answer. – Mujtaba Haider Jun 26 '12 at 10:38
  • > "This week, we started adding a fragment #_=_ to the redirect_uri when this field is left blank. Please ensure that your app can handle this behavior." - I don't have good words about this! @ErwinMSaputra Thanks, for solutuion. – Nikolay Fominyh Aug 13 '12 at 10:49