2022-05-23 11:28:34 +00:00
|
|
|
/**
|
|
|
|
* Checks whether we are loaded in iframe.
|
|
|
|
*
|
2022-07-11 12:30:37 +00:00
|
|
|
* @returns {boolean} Whether the current page is loaded in an iframe.
|
2022-05-23 11:28:34 +00:00
|
|
|
*/
|
|
|
|
export function inIframe(): boolean {
|
|
|
|
if (navigator.product === 'ReactNative') {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
return window.self !== window.top;
|
|
|
|
} catch (e) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|