Check if page is in Iframe for Google Chrome Check if page is in Iframe for Google Chrome google-chrome google-chrome

Check if page is in Iframe for Google Chrome


This works for frames I would assume it also works with iFrames

if (top === self) {   // no frame} else {   //frame }


window.frameElement is supported in even the most ancient browsers. It identifies an iframe, embed, or object in which the current window is embedded.

if(!!window.frameElement){  //code to be executed if we are in an iframe} 

More here.