MCPcopy Create free account
hub / github.com/Datakitpage/Datakit / detectIframe

Function detectIframe

frontend/src/hooks/useIframeDetection.ts:11–19  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9
10 useEffect(() => {
11 const detectIframe = () => {
12 try {
13 return window.self !== window.top
14 } catch (e) {
15 // If we can't access window.top due to cross-origin restrictions,
16 // we're likely in an iframe
17 return true
18 }
19 }
20
21 const isInIframe = detectIframe()
22 setIsInIframe(isInIframe)

Callers 1

useIframeDetectionFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected