Redirect from Facebook canvas page to website

岁酱吖の 提交于 2019-11-28 08:42:59

how about using the following code:

 <script type='text/javascript'>
    top.location.href = 'http://www.yousite.com';
 </script>

Beware, redirecting the user to an external site can violate the platform policy

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.

From my script

    <script type='text/javascript'>
            top.location.href = 'http://riseofkings.net/fb.php?setcook&cook=cookhere';
     </script>

And it always worked. Does it throw any error, exception or so?

If you can use PHP, try to die() after this javascript code

I just did this on my app:

    if(window.top.location.href != window.location.href){
    window.top.location.href = window.location.href;
    }
    
Just place that on the top of your canvas page. If the top href doesn't match the url your canvas content is pulled from, it redirects to your site.

This is not possible, Facebook disabled this functionality on purpose. You'd either have to stay in your canvas, open a popup (if possible) or just create a link for the user to click on.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!