Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the document</title> </head> <body> <script> // Function to check if a webpage is in iFrame function iniFrame() { if(window.self !== window.top) { // !== the operator checks if the operands are // have not the same value or not equal type document.write("The page is in loaded in iFrame"); } else { document.write("The page is loaded directly in the browser window."); } } iniFrame(); </script> </body> </html>