I use before_filter to detect the query string signed_requestthat Facebook generates when a user links to a canvas application.
signed_request
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.
session[:canvas] = true
session[:canvas]
Is there a better way to tell the difference between a canvas and a native browser?
"" Facebook, . fb.mysite.com www.mysite.com , . - , . www.mysite.com/fb/, , www.mysite.com/, , .
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, , .
www.mysite.com/thispage?app=0
app=0
, , signed_request, , , , facebook.
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?