banner reads this is a free feature

Students can share their code online by creating and embedding an HTML file for their programs.

Creating an Embeddable HTML File

JavaScript programs that students create in CodeHS can be embedded on other sites. Follow these steps to take your CodeHS JavaScript code and embed it on your own HTML page:

  1. Open the Code Editor 

  2. Go to More > Embed in the right side bar

embed highlighted from drop down menu from MORE heading

The code for a simple HTML page that runs your JavaScript program is provided in the Embed tab. 

There are two ways that students can embed their code:

Version 1: On Your Computer

  1. Create a file called codehs.html on your desktop.

  2. Copy and paste the HTML code provided into that file.

  3. Double click the file to open it in your browser. You now have a full webpage running outside of CodeHS, locally on your computer!

Version 2: Embed Code Online

  1. Create a file called codehs.html on your desktop.

  2. Copy and paste the HTML code provided into that file.

  3. Upload this file to the Internet

  4. Visit your webpage.

Uploading HTML Files Online

While students can embed their HTML files on any website, they also have the option to create their own homepage hosted on codehs.me!

To do this, students can go to the Sandbox and click Edit My codehs.me Homepage

under heading Welcome to your Sandbox is a green Edit My codehs.me homepage

Here, students can paste in the code from their HTML file. Their websites will be visible at [student username].codehs.me.

Check out this blog post to learn more about how this tool was built and how it works!

CodeHS Tutorial

Our team created a tutorial to show how you can use the CodeHS Graphics JavaScript library outside of CodeHS on any website. Check it out here:

Still have questions? Contact our team at hello@codehs.com to learn more!

Did this answer your question?