how to programmatically check if a context is active
What can be done is to use the context_active_contexts() function.

Sample code, to see if the is_iframe context is active for the current page:

$contexts = context_active_contexts();
if (array_key_exists('is_iframe', $contexts)) : 
    watchdog('te','context is_iframe is set');
endif;