Javascript Browser Window self Property
<!DOCTYPE html> <html> <head> <script> function myFunction() {/*from ww w .j a v a2s . c o m*/ if (window.top != window.self) { document.getElementById("demo").innerHTML = "This window is not the topmost window! Am I in a frame?"; } else { document.getElementById("demo").innerHTML = "This window is the topmost window!"; } } </script> </head> <body> <button onclick="myFunction()">Check window</button> <p id="demo"></p> </body> </html>
The self property returns the current window.
This property is read-only.
The self property returns a reference to the Window object itself.