{"id":846,"date":"2018-02-03T09:44:04","date_gmt":"2018-02-03T09:44:04","guid":{"rendered":"http:\/\/www.netexl.com\/blog\/?p=846"},"modified":"2026-04-02T10:02:56","modified_gmt":"2026-04-02T10:02:56","slug":"tip-of-the-day-check-if-page-is-opened-in-iframe","status":"publish","type":"post","link":"https:\/\/www.netexl.com\/blog\/tip-of-the-day-check-if-page-is-opened-in-iframe\/","title":{"rendered":"Tip of the day: Check if Page is Opened in iFrame"},"content":{"rendered":"<p>Checking this is javascript is straight forward. Check if the window is same as its parent window. If this is the case, it is not an iFrame otherwise, it is an iFrame.<\/p>\n<pre class=\"lang:default decode:true \">if (window.self === window.top){\r\n\tconsole.log(\"Not iFrame\");\r\n} else {\r\n\tconsole.log(\"iFrame\");\r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Checking this is javascript is straight forward. Check if the window is same as its parent window. If this is the case, it is not an iFrame otherwise, it is an iFrame. if (window.self === window.top){ console.log(&#8220;Not iFrame&#8221;); } else { console.log(&#8220;iFrame&#8221;); } &nbsp;<\/p>\n","protected":false},"author":5,"featured_media":1539,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24,22],"tags":[],"class_list":["post-846","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","category-quick-tip"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/posts\/846","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/comments?post=846"}],"version-history":[{"count":1,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/posts\/846\/revisions"}],"predecessor-version":[{"id":847,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/posts\/846\/revisions\/847"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/media\/1539"}],"wp:attachment":[{"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/media?parent=846"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/categories?post=846"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/tags?post=846"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}