In the facebook application, I need to check what the top frame (main window) is and show the content accordingly.
I tried using the following:
if (top.location.toString().toLowerCase().indexOf("facebook.com") <0) { ... }
Which works well if the page is not inside the iframe, but when the page loads in the iframe (as when using it as a facebook application), the code generates
"Dug TypeError: Property 'toString' of object # is not a function."
Is there a way to fix this code (with compatibility between browsers - possibly with jQuery)?
Thanks!
Joel
source share