I'm loading a page into an iframe. Both pages are on the same domain. I want the page being loaded to do specific js functionality only if it has been loaded into an iframe. Is this possible?
Bonus: can it be done in jQuery?
Thanks
or just:
var isEmbed = window != window.parent;
Probably the simplest method:
if ( self !== top ) {
// you're in an iframe
}
So, you check if the current window is the topmost window...
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