CODE CODIFY.CLUB

JavaScript : How to know if current window is the ‘Parent’ or ‘Child’

You cannot do this with PHP; it’s a server side language, not a client side. To detect if you’re in the top level window, you need to do this:

if(window.top == window.self) {
    // Top level window
} else {
    // Not top level. An iframe, popup or something
}

V!ral

Developer, Technology aficionado, Beer Lover and founder of codify.club Network. Who shares a keen interest about website development, health issues, cancer awareness and other fun stuff.

Add comment

Follow us

Don't be shy, get in touch. We love meeting interesting people and making new friends.

Most popular

Most discussed