Determine if request came through a Facebook page tab

facebook, facebook-php-sdk, php

Solution

Check out signed_request which is sent to each page loaded in a Facebook tab.

if (isset($signed_request['page'])) {
   // I'm in a tab  
}

Problem

If the user visits foobar.com through a Facebook page tab I'd like to show them specific data. However, if the user goes directly to foobar.com I'd like to show something different. I've not been able to come up with one good method to do so.

Original source