17 lines
329 B
TypeScript
17 lines
329 B
TypeScript
|
/**
|
||
|
* Checks whether we are loaded in iframe.
|
||
|
*
|
||
|
* @returns Whether the current page is loaded in an iframe.
|
||
|
*/
|
||
|
export function inIframe(): boolean {
|
||
|
if (navigator.product === 'ReactNative') {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
try {
|
||
|
return window.self !== window.top;
|
||
|
} catch (e) {
|
||
|
return true;
|
||
|
}
|
||
|
}
|