开发者

How to load Facebook iFrame-App into Application Tab on Profile Page

how can i load a working iframe app (tested via http://apps.facebook.com/my-app-name) into an application tab on the profile page of my own fanpage. I got the tab, but didn't see anything in the tab. first time i called the tab i got a couple of errors. But now I just see nothing. In sourcecode some css definitions are included.

I read, that profile tabs can only use FBML. Is this right? If true, 开发者_开发百科how can i load an iframe application with FBML into the profile tab?

Thanks in advance.

Marco


To Add an app to a tab you need to make sure you fill out the Tab URL in your App Settings. You can point this to your app if it fits in a 520px or create a custom UI for that width.

Once you have done that go to the profile page for your app: https://www.facebook.com/apps/application.php?id=YOUR_APP_ID

And in the bottom corner click on "Add to my Page", select a page and you are done.


As the previous posters stated, add the URL in the tab settings, and then add the tab to the page.

When your app Tab loads, you will get a different set of values from a regular canvas page. Here is some rough VB.NET code you can use to sort it out..

Public Class TabSignedRequest
    Public user
    '"user":{"country":"us","locale":"en_US","age":{"min":21}}
    Public algorithm
    '"algorithm":"HMAC-SHA256"
    Public issued_at
    '"issued_at":1302500880
    Public user_id
    '"user_id":"148.....47"
    Public oauth_token
    '"oauth_token":"1230................acUfvg"
    Public expires
    '"expires":1302505200
    Public app_data
    Public page As pageObject
    '"page":{"id":"22.........40","liked":true,"admin":true}
    Public profile_id


    Public Shared Function getRequest(ByVal sr As String) As TabSignedRequest
        sr = Replace(sr, "-", "+")
        sr = Replace(sr, "_", "/")
        Dim sig As String
        Dim requestStr As String
        Dim s = Split(sr, ".")
        Try
            sig = iTeam.Common.FromBase64(s(0))
        Catch ex As Exception
        End Try
        requestStr = iTeam.Common.FromBase64(s(1))
        Dim o = Newtonsoft.Json.JsonConvert.DeserializeAnonymousType(Of iTeam.Facebook.TabSignedRequest)(requestStr, New iTeam.Facebook.TabSignedRequest())
        Return o
    End Function
End Class 
Public Shared Function FromBase64(ByVal base64 As String) As String
    If base64 Is Nothing Then Throw New ArgumentNullException("base64")

    Do Until isMult4(base64.Length)
        base64 = base64 & "="
    Loop

    Dim b() As Byte
    b = Convert.FromBase64String(base64)
    Return System.Text.Encoding.UTF8.GetString(b)
End Function
Public Shared Function isMult4(ByVal n As Integer) As Boolean
    Dim r As Integer
    Math.DivRem(n, 4, r)

    Return (r = 0)

End Function


Profile tabs can certainly use iFrame.
Steps:

  1. Goto the working iFrame app (the app you want to add).
  2. Click "Add to My Page" on the left side menu.
  3. Chose your fan page.
  4. You're pretty much done.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜