dua55014 2013-02-11 13:23
浏览 52
已采纳

如何深入链接到Facebook应用程序(不是页面选项卡)

I need to link to a specific page in my Facebook app. The app is not in a page tab, and cannot be in one due to the project constrictions.

This is the url format: https://apps.facebook.com/myappname

I would need to pass a parameter at the end (like /next.html or ?page=next) so that I can link to the specific page directly from outside the app (from an email).

How would I set this up? My project uses PHP and jQuery. I would love to be able to do this strictly in Javascript if possible.

I have found tons of info on how to deep link a page tab or a mobile app, but not to a regular application. I have found messages stating it's possible, but nothing about how to actually do it anywhere online or on Facebook.

Thanks for your help.

EDIT:

Okay, I got it working in PHP. For anyone else with this issue, this is what I did.

Add a "?" at the very end of the 'Site URL' in your FB app, then create a redirect file similar to this as your app landing page (just use absolute paths instead of relative ones like I did below):

<?php
$query = $_SERVER['QUERY_STRING'];
$params = explode("/", $query);

if (in_array("gallery", $params)) {
    header("Location: /gallery.html");
    exit;
}
else {
    header("Location: /index.html");
    exit;
}
?>

This answer is what helped me figure this out: $_GET on facebook iframe app

  • 写回答

3条回答 默认 最新

  • dougua3705 2013-02-11 17:46
    关注

    When you are using the ? all you are doing is issuing a $_GET request, so all of the info you require will exist in the $_GET array.

    Rather than query the $_SERVER array, query the $_GET array.

    So if you had:

    http://myurl.com?info=foobar

    You can simply access that info using:

    $info = $_GET['info'];
    

    It is good practice to check for the existence first though:

    if (isset($_GET['info']))
    {
    $info =$_GET['info'];
    }
    else
    {
    $info="default";
    }
    

    Incidently if you use the & character you can have multiple parameters:

    http://myurl.com?info=foo&moreinfo=bar
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏