Posts Tagged ‘window’

Posted by 6bytes at 30, June, 2011

Category: JavaScript

Tags: , ,

Just a quick tip, how to check if current page has been loaded in an iframe or was it accessed directly.

if (window.self === window.top) {
    // we're NOT in an iframe
} else {
    // we're in an iframe
}

That’s it.