开发者

Canvas app navigation from redirect URL

开发者 https://www.devze.com 2023-03-27 06:04 出处:网络
I\'m working on an app for work and have come to a slight roadblock. How do I navigate to a specific page in my app via redirect_uri?

I'm working on an app for work and have come to a slight roadblock. How do I navigate to a specific page in my app via redirect_uri?

For example, after a user authorizes the app from the home page, I'd like to send them to a different page where they can begin to take action, rather than send them back to the root canvas URL.

I'm using the ifame settup for the app located at www.onewiththem.com/facebook/

In a normal website, if I wanted to send the user to the donate page I would redirect them to www.myappurl/donate, but I have no idea how to do this inside of an iframe (other than have the user click on a link).

Is there something like redirect_uri = apps.facebook.com/myapp/donate that could do this?

A lot of 开发者_JAVA百科facebook sharing features use the redirect_uri parameter to send a user someplace after they've taken action (sharing on their news feed or inviting others to use the app) and it's kindof crappy user experience to send a person back to the home page each time they do something.


Let me know if I am not understanding you question.

If you are using a Facebook application and the other page is also located in you project then you can do a simple window.location = "myLocation" or another equivalent call.

If you do another kind of redirect inside of a Facebook iFrame, then the page will just appear inside that iFrame as if it was part of the app. You should not need to do anything special to navigate between pages (as long as they are part of your application)

If it is not part of the application then you can still redirect, and it will appear inside of that iFrame (though it may not look as nice), though you will have to edit the redirected page so you can go back if you don't want to click the back button every time. There may be some settings that you need to edit if you are redirecting from one facebook page to another one though.

If you have a separate webpage that you want to link to (without showing facebook), then you are going to have to find a different way to do so. You would have to do something like:

window.open('www.yoursite.com','blank','fullscreen, yes');


Because a canvas app is just a website, facebook built in native navigation which means that I can redirect the canvas URL to the actual url of the website

For example, since I want to redirect people to the donation page after they take a social action, I can just redirect to apps.facebook.com/myappcanvas/donation and it will go there.

I guess I was a bit hasty when I asked this question. Should have tried it first.

In summary:

top.location.href = "apps.facebook.com/myappcanvas/secondarypage/tertiarypage/etc";

This works especially if you want to send a user back to a specific page after they invite friends or send a facebook message, or write on their wall.

Hope this helps other developers out there.

0

精彩评论

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