19 lines
529 B
JavaScript
19 lines
529 B
JavaScript
/** 与 tzzx 页 VIEWPORT_HEIGHT_OFFSET 保持一致 */
|
|
const VIEWPORT_HEIGHT_OFFSET = 100;
|
|
|
|
export function getViewportIframeFallbackHeight() {
|
|
return Math.max(window.innerHeight - VIEWPORT_HEIGHT_OFFSET, 480);
|
|
}
|
|
|
|
export function isAllowedIframeMessageOrigin(origin) {
|
|
if (!origin) return false;
|
|
if (origin === window.location.origin) return true;
|
|
try {
|
|
const host = window.location.hostname;
|
|
if (host === 'localhost' || host === '127.0.0.1') return true;
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
return false;
|
|
}
|