-1

My app is my website so I used to put this code in my canvas page so I redirect my users to my website :

<fb:redirect url="http://www.mywebsite.com/" />

but since fbml has been deprecated and will not be supported anymore soon I need to use another method to redirect my users .. is the following code the best I can do or there is another way?

<script type='text/javascript'>top.location.href = 'http://www.mywebsite.com/';</script>
Dido
  • 59
  • 2
  • 8
  • I was just asking if there is a better/safer/recommended way but if it's the best I'll keep using it. – Dido Feb 09 '12 at 08:11
  • it doesn't pass the referrer to Google Analytics when I was using "fb:redirect" the referrer was always **apps.facebook.com/my-app-name** but now with the javascript redirect it shows the referrer as **Direct**. – Dido Feb 09 '12 at 08:15

1 Answers1

1

That's right. You can only do a top.location since you are inside an iframe. See more here: Redirect from Facebook canvas page to website

Community
  • 1
  • 1
Art
  • 5,864
  • 3
  • 30
  • 32
  • Great but it doesn't pass the referrer to Google Analytics when I was using "fb:redirect" the referrer was always **apps.facebook.com/my-app-name** but now with the javascript redirect it shows the referrer as **Direct**. – Dido Feb 09 '12 at 08:14
  • If you want to maintain the referer you can set that directly on the GA client. See docs here: http://code.google.com/apis/analytics/docs/gaJS/gaJSApiSearchEngines.html – Art Feb 09 '12 at 23:00