How to Embed a Flash Game in an HTML Page

TIME : 2016-01-08
How to Embed a Flash Game in an HTML Page

You embed the SWF file with an object element, with an embed fallback inside it for older browsers. Replace the bold placeholders with your own values:

<object width="width" height="height">
<param name="movie" value="file.swf">
<embed src="file.swf" width="width" height="height">
</embed>
</object>

Important context

Flash was officially retired at the end of 2020 and browsers no longer run the plugin, so this markup will not display anything for most visitors today. It is worth knowing for maintaining legacy pages, but not for anything new.

The modern equivalent

HTML5 games use a canvas element with JavaScript, embedded like any other media. If you are converting an old SWF, tools such as Ruffle can run much of the back catalogue in the browser without a plugin.

Either way, set explicit width and height values — a percentage height on an embedded object collapses unpredictably.