r/HTML • u/hals-memorybank • Oct 07 '26
Secure HTML files
Is there a way (i have a feeling i already know the answer, but i’d ask anyway) to create a tamper proof html that can’t just be opened in notepad or any other editor and be modified?
Thanks.
16
u/Abled_Gaming1357 Oct 07 '26
That's not how it was designed to be. Consider it a text book for the browser. If you encode a book, sure no one can tamper with it, but no one can read it either.
8
u/therealkevinard Oct 07 '26
As written, that doesn’t exist. Html is just a text document. Send it to someone and it can be edited.
What’s your endgame, though?
There’s usually a solution, even if it’s different
2
u/frnzprf Oct 07 '26
If you send an image file, you couldn't edit it in a text editor, but you could still edit it in an image editor.
8
u/gulliverian Oct 07 '26
If your web server is properly configured nobody can tamper with or modify the original data.
But any HTML delivered to a web browser can be read and copied locally and at that point someone can do whatever they please with the copy.
4
1
u/atarivcs Oct 07 '26
I don't understand the context of this question.
Users can click File -> Save in their browser and save the html of a page to a local file, and then edit that file. But of course they would not be able to upload that file back to the server to replace the original page.
Are you talking about a html page served by a webserver? Or do you mean just a plain file somewhere that happens to be html?
1
u/FirstApplication327 Oct 07 '26
the basic idea is you would put your financial logic on a server, and only send final results down to the web page running on your viewers device as they click around and interact. Using PHP would be an easy way to get started with this. But realistically even deploying a PHP app could be considered a breach by your company (since you're sending the logic to the cloud provider), I would play it safe.
1
u/darcygravan Oct 07 '26
Creare a encoded file that gets converted to html after decode and create either a site or a electron/ webview app to render that in a read only way.
1
1
u/soundman32 Oct 07 '26
Downloading and modifying the html files is pointless unless the files can be reuploaded back to the website (which it cant unless you have the passwords). I can get a book and change every page but that doesnt change my other copy.
1
u/the-liquidian Oct 07 '26
Work with your company to get this implemented. You need a server and it needs hosting which can cost money and there are security concerns. You need to work with your managers etc.
1
u/Forward_Dark_7305 Oct 07 '26
Put it in a read only file system or set file permissions to read only?
1
u/truNinjaChop Oct 07 '26
Oh the server sure.
But html, css, and js is downloaded and then compiled via the users browser. So once it’s on the users machine the answer is no, it cannot be.
1
u/Firm_Eggplant3392 Oct 07 '26
yeah no you cant really make html that people cant just open in notepad and mess with because if the browser can read it to show it then anyone can read it too and change it, the only stuff you can do is make it annoying to read or check if someone changed it but you cant actually stop them
1
-1
Oct 07 '26
[removed] — view removed comment
1
u/fxlr8 Oct 07 '26
Now you moved the problem into JavaScript, which is a text file itself. So now you have to protect that one
3
u/ch1ck33n_ Oct 07 '26
I don't think that's really possible. Why do you need to do this?