Ask coding questions

← Back to all posts
Embedding repl in a "per-user-only" website.
JulieRapley (0)

I would like to display all my students' repl projects (Java and Python with Turtle) via a school website. I know how to embed the code in an iframe, and I can set the outputonly=true parameter. My problem is that when one student runs the game their output is on the live site rather than a localised, browser-based version. I don't want the users to effectively be able to alter the content of the website which everyone sees - even though it is just in the output panel. Students will write obscene things. grrr. Is there a way to embed a repl such that only that instance is visible to the browser in which it is run, rather than having it update all browsers' content? So if they enter a bad player name etc only they see it. Thanks.

PattanAhmed (1248)

@JulieRapley Hi,
Don't worry...
If you are giving them your Repl Link, then no one can ever edit your code but they can only run your code, instead.
If someone tries to edit your code then, It automatically gets forked into their account and the owner of that Repl will be you as well as they.
And they can edit how much they want under their account and code in your account will stay still or unchanged.
They can only edit your code on one thing that if you invite them to your Repl. (In your case, it isn't)
That's it :)

Hope this helps

JulieRapley (0)

@PattanAhmed Thanks, I am not worried about my code being altered, I realise this is safe. I am worried that students will input offensive terms and others viewing the embedded repl from other machines will see the user's offensive input/output.

SixBeeps (3221)

If you're linking the Repl itself, it shouldn't be editable by everyone. What should happen is when someone tries to change the code, the Repl will get forked, but the original one should stay there for everyone else. Is this not happening?

JulieRapley (0)

@SixBeeps Thank you for your time. I am not concerned that they will change the code, it is that the output of whoever runs the game is reflected in the website. It may be that this is a Google User/Google Sites issue and I can resolve that by setting up different users, but at the moment when I run an embedded repl game and input my name etc as requested by the game the same input and output is visible on a different device viewing the same website.

SixBeeps (3221)

@JulieRapley Ohh, the output is live. I don't believe that's supposed to happen, and it may be a bug. Go ahead and make a ticket on the Bugs forum to get this resolved.