Is there a way to know if your page is opened inside of an IFrame
?
An idea I had was to see if the window
object has a .parent
property, but this apparently is also true of standalone windows which are opened by Javascript's window.open()
function.
Comparing the object's location with the window object's parent location: Here, we simply compare the object's location with the window object's parent location. If the result is true, then the webpage is in an iFrame. If it is false, then it is not in an iFrame.
if (window.top != window.self)
{
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With