1 Answer. You can’t. The client doesn’t even have to use your code at all, they can craft whatever HTTP requests to your server that they want.
Good question with a simple answer: you can’t!
- Trust nobody. When writing code for web applications, do yourself a favor- trust nobody. …
- Minify and Obfuscate: …
- Lint your code. …
- Always have the Strict mode on. …
- Keep it simple.