Challenges can also be embedded via iFrame just like code editor.
You can see a quick demo in action here https://onecompiler.github.io/editor-embed-demo/challenges.html
<iframe
frameBorder="0"
height="700px"
width="100%"
src="https://onecompiler.com/embed/challenges/3w7dby3mt/beginners-coding-challenge"
></iframe>
If you are planning to use the Challenges to be integrated in your LMS/ Website and make your application users take the challenges, please explore the Enterprise APIs section.
More options via query parameters
Query Parameter | Description |
---|---|
theme=dark | Load challenge in Dark Theme |
hideLanguageSelection=true | Disable the Language switch button |
hideNew=true | Disable the Language switch button |
apiKey | Your API account key |
userApiToken | Token you get when sync your application users |
challengeEvents=true | To receive the events of the challenge in parent website |
Capture Challenge Events
You can capture the events of the challenge in your parent website by using challengeEvents=true
In the parent website catch the onmessage
events. Following is the sample code to demonstrate
<script>
window.onmessage = function (e) {
if (e.data && e.data.action) {
console.log(e.data);
// handle the e.data which contains following
// action (ex. challengeFinished), challengeId & userId)
}
};
</script>