Facebook canvas discovery in Rails app

I use before_filter to detect the query string signed_requestthat Facebook generates when a user links to a canvas application.

Then I install session[:canvas] = trueand test this when I need a different application logic based on whether the user is in the canvas or in the browser’s own application. The problem is that if the user for some reason leaves the canvas and goes to the browser, the variable session[:canvas]is still set to true.

Is there a better way to tell the difference between a canvas and a native browser?

+5
source share
3 answers

"" Facebook, . fb.mysite.com www.mysite.com , . - , . www.mysite.com/fb/, , www.mysite.com/, , .

, javascript , (canvas == true). Javascript , iframe, , - www.mysite.com/thispage?app=0. app=0 , ( canvas = false). , Facebook, , .

+4

, , signed_request, , , , facebook.

0

Maybe I'm wrong, but Facebook does not access your POST canvas content instead of a GET request? Isn't that the easiest way to tell where the request came from?

0
source

All Articles