title: Facebook app redirect
body: <p>I have made a facebook application which when opened from <code>apps.facebook.com/myapp</code> points perfectly to my domain's index.php and can be seen in the facebook app window , but problem occurs when i try to redirect it to my register page ,it gets redirected to my domain , i want all the pages to be viewed in facebook app window . tried to use fb:redirect sdk function but site says they are going to deprecate these codes. </p>
  
  <pre><code>&lt;?php
  if(preg_match('/apps.facebook.com/',$_SERVER[HTTP_REFERER])){
      $app_id = '';
      $api_key = '';
      $app_secret = '';
      $canvas_page = 'mydomain/index.php';
      $auth_url = "http://www.facebook.com/dialog/oauth?client_id=".
      $app_id."&amp;redirect_uri=".urlencode($canvas_page)."&amp;scope=email,user_birthday,user_interests,user_about_me";
      $signed_request = $_REQUEST["signed_request"];
      list($encoded_sig, $payload) = explode('.', $signed_request, 2);
      $data = json_decode(base64_decode(strtr($payload,'-_', '+/')), true);
      if (empty($data["user_id"])){
          echo("&lt;script&gt; top.location.href='".$auth_url ."'&lt;/script&gt;");
      }else{
          $canvas_page="mydomain/register.php";
          echo ("&lt;script&gt; top.location.href='".$auth_url."'&lt;/script&gt;");
      }
  }else{
      echo "No facebook";
  }
  ?&gt;
  </code></pre>
  
  <p>the code works perfectly up till <code>echo("&lt;script&gt; top.location.href='" .$auth_url ."'&lt;/script&gt;")</code> when <code>$canvas_page</code> is the one set in facebook app dev form ; but gets redirected to some other page when <code>$canvas_page</code> is changed to my register.php page .   where am i going wrong ?</p>
  
  <p>thanks in advance</p>