I am writing an iframe based facebook app. Now I want to use the same html page to render the normal website as well as the canvas page within facebook. I want to know if I can determine whether the page has been loaded inside the iframe or directly in the browser?
Javascript – How to identify if a webpage is being loaded inside an iframe or directly into the browser window
facebookiframejavascript
Related Topic
- Javascript – Get image data URL in JavaScript
- Javascript – How to access parent Iframe from JavaScript
- Javascript – Frame Buster Buster … buster code needed
- Javascript – How to get the browser viewport dimensions
- Javascript – Get the size of the screen, current web page and browser window
- Javascript – How to access the correct `this` inside a callback
Best Answer
Browsers can block access to
window.top
due to same origin policy. IE bugs also take place. Here's the working code:top
andself
are bothwindow
objects (along withparent
), so you're seeing if your window is the top window.