Required attribute
allow="fullscreen" lets the game enter full-screen mode, which several games rely on for a usable layout on small viewports. Omit it and players get a cramped experience with no way out of it.
Sizing
- Mobile
- Desktop and tablet
The units are deliberate.
lvh/lvw (largest viewport) on mobile reserve space for the browser chrome at its smallest, so the game does not get clipped when the address bar retracts. svh/svw (smallest viewport) on desktop size against the stable viewport. Substituting vh reintroduces the mobile clipping these units exist to avoid.A working embed
What you take on
Viewport and keyboard on mobile
Viewport and keyboard on mobile
The on-screen keyboard resizes the viewport, and browser chrome appears and retracts as the player scrolls. Both can shrink the game below a playable size unless the container is sized in
lvh/lvw as specified.Full-screen and orientation
Full-screen and orientation
Without
allow="fullscreen" the game cannot escape your container. Some games are unusable in portrait on a small viewport, and full screen is their way out.Third-party storage restrictions
Third-party storage restrictions
Safari’s ITP and equivalent protections restrict storage in third-party frames. Sessions that survive a reload in a top-level tab can silently fail to resume inside an iframe.
Nested scroll containers
Nested scroll containers
An iframe inside a scrollable wrapper produces two competing scroll surfaces. Touch gestures meant for the game get eaten by your page.