Ask coding questions

← Back to all posts
Repl Secrets in HTML files?
frostedbutton75 (52)

Well, it works in PY but not HTML. How would I make it work in HTML?

Comments
hotnewtop
AarjavKavathia (5)

A bit late but you can also create a PHP Webserver project. You can access the secrets there and it works like html.

ch1ck3n (2027)

html are static projects so you cant. also if it's a secret in HTML and the web site can access it, hackers can also get it so it's not a secret.

ch1ck3n (2027)

@frostedbutton75 well it also might depend on what you are making. what are you making anyways

ch1ck3n (2027)

@frostedbutton75 if you are using an api with an API key, just make a backend and use the env secrets. then send the res without the API key but with the data the API sent you

frostedbutton75 (52)

a "yourpersonalsafe" and i create accounts for ppl and i need to hide passds.
@ch1ck3n

ch1ck3n (2027)

@frostedbutton75 ok you need a backend surely for that

xfinnbar (81)

@frostedbutton75 A backend is a server that you can request data from. There are two main principles of having a server.

The server can either:

  • Directly edit your HTML using a template engine. See Flask templates.
  • Create an "endpoint" which you can call using JavaScript. See the JS Fetch function.

I recommend Flask as your server: https://www.youtube.com/watch?v=mqhxxeeTbu0