JavaScript is required

How to Embed EmulatorJS on your Website

The System Page will have examples for all the supported systems.

HTML

If you have a http server then the Get Started Page has a working example for the NES.

React / Single Page Apps

To embed within React or a SPA, the only way is to embed an iframe into your page, and run this emulator within that iframe. You cannot run it directly on the page. This will break single page apps, and tamper with the DOM.

Google Sites

Here is an example made in google sites: EmulatorJS Google Sites Example

  • It is recommended if you game file is 1 mb then to host your ROM on a server and not base64.
  • Just add a full page embed with custom code, instrctions here
  • You can use DriveToWeb if you want to host your files using google drive (as show in the working example below) Here is the code used in the example game:
<html>
    <head>
        <style>
            body, html {
                margin: 0;
                padding: 0;
            }
        </style>
    </head>
    <body>
        <div style="width:100%;height:100%;max-width:100%">
            <div id="game"></div>
        </div>
        <script>
            EJS_player = "#game";
            EJS_core = "CORE_NAME";
            EJS_pathtodata = "https://cdn.emulatorjs.org/stable/data/";
            EJS_gameUrl = "https://allancoding-website-files.on.drv.tw/ROM_FILE_NAME_&_PATH.zip";
        </script>
        <script src="https://cdn.emulatorjs.org/stable/data/loader.js"></script>
    </body>
</html>