Some facebook applications might have multiple entries. For example, a user might be adding an application (action – new) or replying to an invitation (action – reply, param – id). Since the UI for Facebook application configuration allows to provide only static Post-Add URL it might seem like there is no way to route users back to the original action if they tried to reach when the application has not been installed for them. Luckily, we have full control on the destination via the next paramater of the post install URL. All we need is to build a URL using the incoming call parameters with the exclusion of Facebook-specific ones.
This is an example for Facebook on Rails based code that might go to the application controller:
class ApplicationController < Facebook::FBMLController protected before_filter :require_facebook_install def require_facebook_install if in_canvas? && !fbsession.is_valid? redirect_to fbsession.get_install_url(:next => url_for(post_install_params)) false end end def post_install_params params.merge(:init => true).delete_if { |k, v| k.starts_with?('fb_sig') } end end
Notice that the code sets the init parameter so it can be used to identify a post install call






