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:
Open the Code Editor
Go to More > Embed in the right side bar
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
Create a file called codehs.html on your desktop.
Copy and paste the HTML code provided into that file.
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
Create a file called codehs.html on your desktop.
Copy and paste the HTML code provided into that file.
Upload this file to the Internet
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
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!