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("Not iFrame"); } else { console.log("iFrame"); }