/** * @name isInIframe * @namespace js.is * @type Function * @platform js * @status stable * * Check if the page is loaded inside an iframe * * @return {Boolean} true if in iframe, false if not * * @snippet __isInIframe($1) * * @todo tests * * @example js * import { __isInIframe } from '@lotsof/sugar/dom' * if (__isInIframe()) { * // do something * } * * @since 1.0.0 * @author Olivier Bossel (https://lotsof.dev) */ export default function __isInIframe(): boolean { try { return window.self !== window.top; } catch (e) { return true; } }