title: Facebook App via PHP SDK - Redirecting back to page where someone added my app after getting permissions
body: <p>I have little problem. When I need my app to ask user to grant permissions to the app I use following code:</p>
  
  <pre><code>&lt;?php
  $loginUrl = $facebook-&gt;getLoginUrl(
  array(
      'canvas'    =&gt; 1,
      'fbconnect' =&gt; 0,
      'scope' =&gt; 'email,publish_stream,offline_access',
  ));
  ?&gt;
  echo "&lt;script type='text/javascript'&gt;top.location.href = '$loginUrl';&lt;/script&gt;";
  </code></pre>
  
  <p>I works OK, but after user press "grant permissions" he is redirected to my app URL. I mean like <a href="http://mydomain.com/myapp/" rel="noreferrer">http://mydomain.com/myapp/</a> directly, not my app page on Facebook. 
  I can work around it - I know my app's Facebook address, so I redirect him to proper <a href="http://apps.facebook.com/myappname" rel="noreferrer">http://apps.facebook.com/myappname</a>. It works OK too. BUT - when somebody adds my application on some page tab - here is where problem appears. Because I don't know where to redirect user anymore - I don't know, from what page my app was called. </p>
  
  <p>Is there any way to get to know, from what page my app was called, or, even better, to make Facebook properly redirect user to the "facebook page" where app tab were added after "grant permission" dialog ?</p>