Embed a browser game on your site

To embed a browser game on your site, put its link in an iframe with a width and height or an aspect-ratio, add allow="fullscreen; autoplay", and check that the game's host doesn't block framing with X-Frame-Options or a frame-ancestors list. Expect saves in the frame to be kept apart from the game's own page, and add loading="lazy" to a game lower down. Then list it on Foundplay for free: Play opens it where you published it.

Checked November 23, 2026. Written by Foundplay, a game discovery platform for free browser games.

Copy this to start

In your page, with your game's link and name
<iframe
  src="https://your-game.example/"
  title="Your game's name"
  style="width: 100%; height: auto; aspect-ratio: 16 / 9; border: 0;"
  allow="fullscreen; autoplay"
  loading="lazy"></iframe>

What to get right

  • Size

    What to do
    Put the game's link in an iframe with a width and height, or width: 100% with an aspect-ratio and height: auto so it keeps its shape as the page narrows. Give it a title, such as the game's name, so screen readers can label it.
    Watch for
    With no size set, an iframe is 300 by 150 CSS pixels. Each iframe takes more memory and computing, so check performance when a page holds several. Godot's web page draws the game at the full size of its window, so it fills the frame you give it.

    Sources: MDN: iframe, MDN: aspect-ratio, Godot: Exporting for the Web

    Checked November 23, 2026.

  • Fullscreen

    What to do
    Add fullscreen to the iframe's allow attribute, as in allow="fullscreen", so the game can call requestFullscreen() from inside the frame.
    Watch for
    allowfullscreen is the older way: MDN calls it a legacy attribute, redefined as allow="fullscreen *". A feature named without origins is allowed for the frame's src origin. Browsers still enter fullscreen only from the player's tap or click.

    Sources: MDN: iframe, MDN: Permissions-Policy, Godot: Exporting for the Web

    Checked November 23, 2026.

  • Sound

    What to do
    Add autoplay to the allow attribute, as in allow="fullscreen; autoplay". The autoplay policy is self by default, so a game embedded from another site doesn't get it otherwise.
    Watch for
    Start sound from the player's first click inside the game anyway: browsers generally block sound before any interaction. If your own page sends a Permissions-Policy header, the allow attribute can only narrow it, never widen it.

    Sources: MDN: Autoplay guide, MDN: iframe, MDN: Permissions-Policy

    Checked November 23, 2026.

  • Saves

    What to do
    Expect saves in your embed to be kept apart from saves on the game's own page. Firefox partitions localStorage, IndexedDB and other storage by the top-level site, so the same game embedded on two sites sees two sets of data.
    Watch for
    Godot keeps user:// saves in IndexedDB, and its docs say a game shown in an iframe also needs third-party cookies enabled for them to last; private browsing keeps none. A frame can ask for its own cookies with document.requestStorageAccess().

    Sources: MDN: State Partitioning, Godot: Exporting for the Web

    Checked November 23, 2026.

  • Blocked framing

    What to do
    Before you embed, check that the game's page doesn't send X-Frame-Options: DENY or SAMEORIGIN, or a Content-Security-Policy frame-ancestors list that leaves your site out. To let your site in, the game's host sends frame-ancestors 'self' and your site's address.
    Watch for
    Both have to be response headers: X-Frame-Options in a meta tag has no effect, and frame-ancestors isn't supported in a meta element. With neither sent, browsers let other sites embed the page.

    Sources: MDN: X-Frame-Options, MDN: frame-ancestors

    Checked November 23, 2026.

  • Lazy loading

    What to do
    Add loading="lazy" to a game lower down the page, so the browser fetches it only as the player scrolls near it.
    Watch for
    Without it the frame loads at once, which is the default. The page's load event can fire before a lazy frame has loaded, and loading is deferred only when JavaScript is on.

    Sources: MDN: Lazy loading, MDN: iframe

    Checked November 23, 2026.

  • itch.io

    What to do
    itch.io's widget is a piece of HTML for other sites. Find it in the project's widgets panel, linked from your dashboard and from the project's page, in light or dark.
    Watch for
    For a web game, the widget links back to the game's page on itch.io rather than playing it in yours.

    Sources: itch.io: Widget embed

    Checked November 23, 2026.

  • Foundplay

    What to do
    List the game for free with the link where it plays, on your own site or itch.io page.
    Watch for
    Foundplay doesn't embed or host the game: Play opens it on its own page, so your sound, saves and headers work as you set them.

    Sources: Submit a game

    Checked November 23, 2026.

Questions

How do I embed an HTML5 game on my website?
Put the game's link in an iframe with a title, a width and height or width: 100% with an aspect-ratio, and allow="fullscreen; autoplay". The code above is a start.
Why won't my game load in an iframe?
The game's page may send X-Frame-Options: DENY or SAMEORIGIN, or a Content-Security-Policy frame-ancestors list without your site. Either stops other sites from framing it. Change the header where the game is hosted, since neither works from a meta tag.
How do I let an embedded game go fullscreen?
Add fullscreen to the iframe's allow attribute. The older allowfullscreen attribute is redefined as allow="fullscreen *". The game then calls requestFullscreen() from a tap or click.
Why don't saves carry over between my site and the game's page?
Firefox partitions storage such as localStorage and IndexedDB by the top-level site, so a frame on your site sees its own data. Godot's docs add that a game in an iframe needs third-party cookies enabled for user:// saves to last.
Can I embed my itch.io game on my own site?
itch.io's widget is a piece of HTML for other sites, from the project's widgets panel. For a web game it links back to the game's itch.io page. To play the game inside your page, embed a build you host in an iframe, as above.
Does Foundplay embed my game?
No. Foundplay lists the link for free and Play opens the game where you published it. List it, and see where to upload your HTML5 game for hosts.

More for makers: Make your browser game work on phones, Make your browser game load faster, Browser game file size limits, Cross-origin isolation for browser games, Where to upload your HTML5 game, List your browser game for free and Submit a game to Foundplay.