What is the best way to hide visible JS functions when specifying HTML?

Asked

Viewed 177 times

0

I have some Javascript functions in my pages that were previously inserted directly into jsp, within the tags <script>. I later changed them to a.js file where I just import the functions. I wonder if there is a better way to hide such functions, making it difficult for the user to find them.

  • 4

    No, at most you can use uglify to make it difficult to read javascript. If you have some code that should not be exposed in the client do it in the backend and not on the front.

  • 2

    Ask "hints" avoid words like "better" because it will end up in the subjectivity of "based on opinions" and your question may end up being closed

1 answer

2


You won’t be able to hide it, but you can make things difficult, minify your script and swap explicit names for vowels or symbols, make your code illegible by a human. I use the uglify for that reason

Browser other questions tagged

You are not signed in. Login or sign up in order to post.