Running shell command when clicking Run button

Question:
I was wondering if there a way to run a shell command in a HTML, CSS, JS Repl when clicking on the Run button.

You could maybe detect the run button being clicked with a browser extension and make the extension send a request to another repl, which tells a program started when the container boots (using onBoot) to execute a program.

3 Likes

I don’t think that’s possible as HTML, CSS, JS Repls are “special,” they’re statically hosted.

Or you could use a browser extension as 9pfs said lol.

2 Likes

The correct way is to create a back end script in (for example) php and run that. However, there are struck security rules around these things and I am nit sure it will result what what you have in mind (for example: do you mean server or client shell?)

3 Likes

You can’t run PHP in an HTML, CSS, JS Repl… Or any backend.

2 Likes

There used to be ways (years back, I admit my last try was like 10 years ago), did they block also those now?

3 Likes

You remember this thread, don’t you?: Can you use PHP in an HTML, CSS, JS template? - #5 by MattDESTROYER

3 Likes

man, I got confused again … either I am still half sleeping (just stood up) or it is an age thing. Sorry

2 Likes

After trying out different methods you guys have suggested and methods from the internet, going as far as looking at the .replit configuration docs and solving it myself, I couldn’t find a reliable and sustainable solution to run shell commands in a HTML, CSS, JS Repl. So therefore, I have decided to just use Node.js to host and run the commands which seem to work well.

To those who tried to help me solve this problem, I am genuinely sorry for wasting your precious time fixing this issue. I truly appreciate your help and support you provided to me regarding this issue and I seriously can’t thank you enough.

I’m going to mark @whileTRUEpass’ answer as the solution, for he had the closest solution to my problem, and what I later decided to do to fix my problem.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.