Note that there are some explanatory texts on larger screens.

plurals
  1. POGet Facebook Page Tab ID of current Tab?
    primarykey
    data
    text
    <p>I am trying to figure out how to get the tab ID of the current tab of a Facebook Page the user is visiting.</p> <p>I have made an app for installation on Facebook Pages, that I need to save settings for, per instance. I have figured out that you can get an array of tabs for the page the app is installed on, but I can't figure out how to get the tab ID for the actual tab you're on. </p> <p>The point is for an admin to be able to save settings for each tab that they've added the app to, using a single backend. I'm not sure if you can have multiple instances of one app on the same page, but if not, we'd have 2-3 duplicate apps with the same backend in the iframe. Because of that, I need to be able to identify app installations as unique - the best way I can figure out is through using the page id and tab id, for the app.</p> <p>How do I do that?</p> <p><strong>UPDATE:</strong> Found out that you can only have one instance per app on a page.</p> <p>With that, I went with using this solution (with '/tabs/' to get the tab info):</p> <pre><code>try { $tab = $facebook-&gt;api('/'.$fb_page_id.'/tabs/'.$fb_app_id); $fb_tab_link = $tab['data'][0]['link']; } catch (FacebookApiException $e) { echo '&lt;!-- '.htmlspecialchars(print_r($e, true)).' --&gt;'; } </code></pre> <p>In the above code, <code>$fb_tab_link</code> or a combination of <code>$fb_page_id</code> and <code>$fb_app_id</code> can be used as unique identifier. I decided to use the concatenation <code>$fb_page_id . '-' . $fb_app_id</code> as the instance ID.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload