@jasen_gottlieb
To check if an element is being loaded by an iframe, you can use the following approach:
1
|
var parentDoc = element.ownerDocument; |
1 2 3 4 5 |
if (parentDoc !== document) { console.log("Element is being loaded by an iframe"); } else { console.log("Element is not being loaded by an iframe"); } |
This code snippet determines if the element is being loaded within the current document or in an iframe. If the parent document is different from the current document, it means the element is being loaded by an iframe.