<!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> var v = window.self.self.parent.frameElement if (v !== null) alert("not null") else alert("null") <!-- language: lang-css --> #inner { margin-left: 100px; visibility: visible; } <!-- language: lang-html --> <iframe id="inner" srcdoc="<h1>Inner Frame</h1>"></iframe> <!-- end snippet -->