Is it possible to hide or scramble/obfuscate the javascript code of a webpage?

后端 未结 9 1153
情深已故
情深已故 2020-12-10 15:38

I understand that client side code must be readable from the browser but I wonder (since there are too many things that I ignore) if there are ways to obfuscate to code to t

相关标签:
9条回答
  • 2020-12-10 16:17

    See here for a Free Javascript Obfuscator.

    Given that it is in fact possible, if the reason you intend to obfuscate is to protect intellectual property, you are probably trying to derive value from your work the wrong way. It's fairly easy to reverse the obfuscation, and you would probably be wasting time maintaining your code.

    Focus more on what services you intend to provide to those who visit your site as a means to differentiate your site from competitors

    0 讨论(0)
  • 2020-12-10 16:20

    Step 1: Don't.

    You would have to do a lot to achieve any meaningful level of obfuscation. Obfuscating the names alone is not enough, since all of the standard functions will still be there (although they may be buried in a layer of shorter/obfuscated aliases), and deriving the purpose of a particular function is easy once the code is formatted nicely again. Anybody who really wants to know what your JS code does can, and will, no matter what you do to it before their browser gets a copy of it.

    If you truly have valuable business processes in your JavaScript, then you're Doing It Wrong(tm).

    0 讨论(0)
  • 2020-12-10 16:21

    There are tools that could be used to compress javascript code and render it difficult for the end user to understand.

    0 讨论(0)
提交回复
热议问题