Here's a step-by-step guide to display H5P content using the h5p-standalone library (no programming skills needed):
- Open a text editor (e.g., Notepad, VS Code, Sublime Text).
- Create a new file and save it as
index.html
. - Add this basic HTML structure:
<!DOCTYPE html> <html> <head> <title>My H5P Content</title> </head> <body> <!-- Container where H5P content will appear --> <div id="h5p-container"></div> <!-- Include h5p-standalone JavaScript --> <script src="https://unpkg.com/[email protected]/dist/main.bundle.js"></script> </body> </html>
-
Prepare your H5P content.
- In the same folder as your HTML file, create a subfolder named
h5p-content
- Extract or unzip the
.h5p
content into theh5p-content
subfolder
- In the same folder as your HTML file, create a subfolder named
-
Initialize H5P by adding this script just before the closing
</body>
tag in the above html structure:<script> // Initialize H5P window.addEventListener('DOMContentLoaded', function () { const options = { h5pJsonPath: './h5p-content/course-presentation-123', // Path to your H5P content frameJs: 'https://unpkg.com/[email protected]/dist/frame.bundle.js', frameCss: 'https://unpkg.com/[email protected]/dist/styles/h5p.css' }; const container = document.getElementById('h5p-container'); new H5PStandalone.H5P(container, options); }); </script>
- Your H5P content must be structured properly. For example:
your-project-folder/ ├── index.html └── h5p-content/ └── course-presentation-123/ ├── content.json ├── example.js └── example.css
- Replace
course-presentation-123
with your H5P content folder (containingcontent.json
and other files).
- Replace
- Open
index.html
in a web browser (Chrome/Firefox recommended). - The H5P content should load automatically.
⚠️ If it doesn’t:- Check file paths (e.g., ensure
h5pJsonPath
points to the correct folder). - Open the browser’s developer console (press
F12
) for error messages.
- Check file paths (e.g., ensure
-
CORS Errors: If you see "Cross-Origin Request Blocked", use a local server instead of opening the file directly.
-
Missing Files: Ensure all H5P dependencies (JS/CSS) are in the correct folder.
If your H5P content is a Multiple Choice Quiz, your folder might look like:
h5p-content/
└── multiple-choice/
├── content.json
├── scripts/
│ └── multiple-choice.js
└── styles/
└── multiple-choice.css
You now have a working H5P viewer! Replace the example content with your own H5P projects.
For more details, visit the h5p-standalone GitHub page.
I have created following demo to illustrate the output of above instructions https://github.com/murage-poc/h5p-standalone-demo