Hi all, I have a facebook page tab application that is hosted on my server.
If I navigate to the FQD location the page will load as you would expect.
What I would like to do is detect if the page is being loaded inside an iframe, ie. being displayed from inside facebook, from the page tab application. ie. https://www.facebook.com/pagename/app_257600168717381
If the page is being displayed from outside of facebook, ie. domainname.com/dir/facebook-app is in the address bar of the browser, I would like to auto redirect the page to the facebook page tab application url.
I have found the following code, but my page just loops ?
<script type="text/javascript">
top.location.href = "https://www.facebook.com/pagename/app_257600168717381";
</script>
I have a variable called $token that is the full https://www.facebook.com/pagename/app_257600168717381 path
How can I edit the script to first detect if the page is being loaded within a iframe and secondly auto redirect the header location, using the $token variable if the page is being loaded from the address bar url.