> > Actually we are implementing FB login for our app. For this we want to > detect whether /user/login controller was a redirect from facebook (after > authentication) or a a user noramlly opened /user/login in their browser. > > Sometimes FB reidrects to /user/login#_=_ and sometimes to > /user/login?code=........................ > > [ > "Change in Session Redirect Behavior. 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/ > > > ] > > How can I differentiate b/w the two? >
I'm not sure you can when the request is first made, as the server only receives a request for /user/login, even if FB redirects to /user/login#_=_. After the redirect, you could use Javascript on the client side to see if there is a hash in the URL (e.g., using window.location.hash), and then possibly send an Ajax request to get the appropriate data in either case. Anthony