【问题标题】:Deeplinking using GWT History Token within a Facebook iFrame Canvas在 Facebook iFrame 画布中使用 GWT 历史令牌进行深度链接
【发布时间】:2010-03-19 00:21:06
【问题描述】:

我想直接深度链接到 Facebook iFrame 画布中的 GWT 应用页面。

第一部分很简单,使用带有以下 URL 的 GWT 历史令牌:

http://www.example.com/MyApp/#page1

这将在我的应用程序中打开 page1。

Facebook 应用程序使用的应用程序 URL 如下:

http://apps.facebook.com/myAppName

构成我的 Canvas 回调 URL 的框架

http://www.example.com/MyApp/

有没有办法指定一个画布回调 url(或书签 url),它将用户带到特定页面而不是索引页面?

为什么?你可能会问。除了深层链接的所有好处...

  • 我希望“转到应用程序”url 将用户带到带有营销材料的索引页面(画布回调 url)

  • 我希望“书签 URL”将(可能返回)用户带到登录页面,并绕过下载营销内容(以及那个巨大的 SWF 文件)。

【问题讨论】:

    标签: facebook gwt


    【解决方案1】:

    这似乎是一个 hack,但它就是这样。

    Facebook 允许应用程序将参数附加到 url ?x=123

    所以我正在检查窗口位置以查看它是否包含我的特殊“页面”参数并加载该页面。下面是我的解决方案,因为我正在使用 GWT + gwt-presenter 的 PlaceManager 类。

    应用程序深层 url 最终是 http://apps.facebook.com/myAppName?page=page1

        EventBus eventBus = injector.getEventBus();
    
        // Load PlaceManager so it can start listening
        PlaceManager placeManager = injector.getPlaceManager();
        String currentPlace = History.getToken();
    
        String place = Window.Location.getParameter( "page" );
        if (place != null && !place.isEmpty()) {
            // send user to the place on the URL line
            eventBus.fireEvent( new PlaceRequestEvent( new PlaceRequest( new Place (place) ) ));
    
        } else if ("".equals(currentPlace)) {
            // Nothing in URL, load default GWTpage
            eventBus.fireEvent( new PlaceRequestEvent(new PlaceRequest( IndexPresenter.PLACE)));
    
        } else {
            // fire a body to the Place Manager to activate the requsted Place
            placeManager.fireCurrentPlace();
        }
    

    【讨论】:

    • 这很好而且正确 - 但是如果应用程序被用作页面内的“标签”怎么办?
    • 如果页面用作选项卡,请使用http://www.facebook.com/profile.php?id=<userId>&sk=app_<appId>&app_data=myPlace 之类的 URL,并在代码中从 facebook signed_request 参数中提取 "myPlace"developers.facebook.com/docs/authentication/signed_request
    猜你喜欢
    • 2017-04-03
    • 1970-01-01
    • 2020-05-14
    • 2012-01-06
    • 1970-01-01
    • 1970-01-01
    • 2014-08-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多