Check if actual window is a iframe
var isInIFrame = (window.location != window.parent.location);
if(isInIFrame==true){
// iframe
}
else {
// no iframe
}
This is true if a window is not a frame/iframe:
if(self!=top){
console.log('window is a frame/iframe')
}
function inIframe () {
try {
return window.self !== window.top;
} catch (e) {
return true;
}
}
function iniFrame() {
if ( window.location !== window.parent.location )
{
// The page is in an iFrames
document.write("The page is in an iFrame");
}
else {
// The page is not in an iFrame
document.write("The page is not in an iFrame");
}
}