質問

I know there is a way to redirect the page using javascript in the iframe of the canvas application to an external url.But is there any other way so that user directly gets redirected to the external url as soon as they authorizes the application.

i know it is possible because a famous app klout in Facebook does it.

http://apps.facebook.com/klout__/

redirects to

http://klout.com/ automatically as soon as the user

Remember i got an invitation request from my Facebook friend.when i clicked the invitation notification and when i authorized the application it redirected to a external url.Any idea how this has been done? And i think this wont be encouraged in Facebook policies either?

役に立ちましたか?

解決

Facebook want to make sure that the servers it interacts with are of the same domain that is set up in the app settings.

In the klout example you gave what they did was to add an App Domain which is done in the app settings, but there's a limitation to what domains you can add there. For example if your site url in the settings is set to "www.example.com" then you can add "examlpe.com" or "sub.example.com" to the app domains. But if you try to add "www.example2.com" you'll get:

Error

example2.com must be derived from your Site URL or your Mobile Web URL.


Edit

I'm sorry, I did not understand you correctly.

If you want to simply redirect the user to your url in the main window then you can use javascript like this:

top.location.href = "http://www.example.com";

What I was referring to before is the ability to have "www.example.com/" as the site url (in the settings) and still use "sub.example.com" with redirect_uri and such.


2nd Edit

Forgot to mention this: In the Facebook Platform Policies it states that:

13 . The primary purpose of your Canvas or Page Tab app on Facebook must not be to simply redirect users out of the Facebook experience and onto an external site

And so you should not redirect the users out of facebook.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top