| 1 |
// Extendify's front-end surfaces (Quick Edit, the Agent, the simple toolbar) |
| 2 |
// must never activate inside another tool's iframe. The Customizer preview, |
| 3 |
// multilingual editors, and page-builder previews are all front-end renders, |
| 4 |
// so the bundles enqueue and would otherwise mount — but Extendify only |
| 5 |
// belongs on the live, top-level page. The live front end is always |
| 6 |
// top-level, so a single `self !== top` check rules out every framed |
| 7 |
// context, present and future. |
| 8 |
export const isEmbedded = (win = window) => { |
| 9 |
try { |
| 10 |
return win.self !== win.top; |
| 11 |
} catch { |
| 12 |
// A cross-origin parent throws on `.top` access; that, too, is framed. |
| 13 |
return true; |
| 14 |
} |
| 15 |
}; |
| 16 |
|