1

have created a Facebook App,As we know Facebook app have 2 URLs. Page Tab URL and Application URL.In my code if I redirect user to Page Tab URL it gives me FacebookGraphMethod Exception.May be I need to redirect with additional parameters.Anyone who can help with this\ For Example The Page Tab URL is abc.com/main.php From main.php I navigate to xyz.php Now I want to go back to main.php what should I do,I even tried window.location.href Thanks

2 Answers 2

1

you first need to add your App to a page. Then, you can access it on this page by clicking he app icon (or to an URL like this: http://facebook.com/{{page_username}}/app_{{app_id}}).

You can get the page username using this method on FB API:

$profile = $facebook->api('/' . $PageInfo['page']['id'], 'GET');
$page_username = $profile['username'];

To add the app to a page, you can use the add page tab dialog: https://developers.facebook.com/docs/reference/dialogs/add_to_page/

12
  • I have already did added into my page.What If I want to redirect my user back to this Page Tab?
    – user1765876
    Dec 17, 2012 at 19:17
  • Then, like I said, you use this URL: http://facebook.com/{{page_username}}/app_{{app_id}} Dec 17, 2012 at 19:19
  • @SimonBoudrias I just tried this.Throughout the app the URL remain the same..I tried facebook.com{{page_username}}/app_{{app_id}} ,but it just load the same page and doesn't redirect me to PageTab URL Dec 17, 2012 at 19:21
  • I added instructions on how to get the page_username from the Graph API if you don't want to hardcode it. Dec 17, 2012 at 19:22
  • 1
    Have you tried using top.location.href. This is the code that I use on index.php for page tab applications. <?php echo "<script type='text/javascript'>top.location.href='".$fbpagetaburl."';</script>"; exit; ?> Dec 18, 2012 at 10:37
0

Use top.location.href to redirect to page tab.

<?php 
  echo "<script type='text/javascript'>top.location.href='".$fbpagetaburl."';</script>";
  exit; 
 ?> 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.