Yes, That is a solution but not the most elegant one :(
Saurabh On Monday, March 12, 2012 8:20:12 PM UTC+5:30, Anthony wrote: > > 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 >