PluginProbe
Extendify / 3.1.5
Extendify v3.1.5
3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 0.7.0 All 126 releases
extendify / src / Shared / lib / embedded-guard.js

embedded-guard.js in Extendify 3.1.5, at src/Shared/lib/embedded-guard.js

16 lines 669 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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