unis-oa/frontend/preview-frame.html

30 lines
849 B
HTML
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<title>预览:一台 390 的屏</title>
<style>
body {
margin: 0;
background: #e9eaee;
}
iframe {
display: block;
border: 0;
width: var(--w, 390px);
height: var(--h, 844px);
}
</style>
</head>
<body>
<iframe id="f"></iframe>
<script>
const p = new URLSearchParams(location.search);
// 套一层 iframe 是因为 headless Chrome 把窗口宽度钳在 500,量不到真手机的 390
document.documentElement.style.setProperty('--w', (p.get('w') || 390) + 'px');
document.documentElement.style.setProperty('--h', (p.get('h') || 844) + 'px');
document.getElementById('f').src = p.get('src') || '/preview-mobile.html';
</script>
</body>
</html>