免费的 JavaScript 混淆器?
我正在寻找一个免费 JavaScript 混淆器。 压缩就足够了吗? 您会推荐哪些工具? 当然,我不需要军事式的混淆,我需要一种简单的方法来防止小孩子通过查看源代码或使用诸如 unescape() 之类的简单方法来窃取我的 javascript。
谢谢, 汤姆
I'm looking for a free JavaScript obfuscator. Would compression be enough? What tools would you recommend? Of course, I don't need military-style obfuscation, I need a simple way to prevent kiddies from stealing my javascript by looking at the source or by using something simple such as unescape().
Thanks,
Tom
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
你的问题是,无论你如何压缩或隐藏它,最终浏览器都必须解释它。 您能做的最好的事情就是将所有变量重命名为无意义的随机变量,并删除所有注释和空格。
一些不错的工具:
Your problem is that no matter how much you compress it or hide it, eventually the browser has to interpret it. The best you can do is renaming all variables to meaningless random vars, and removing all comments and whitespace.
A few good tools:
您可以使用 /packer/
http://dean.edwards.name/packer/
You can use /packer/
http://dean.edwards.name/packer/
根据经验,不要使用使用 eval 的混淆器,因为这会减慢页面速度,而使用不使用 eval 的压缩器。 这将为新手提供混淆,无论如何,其他任何人都不会被任何混淆器吓倒。
大多数混淆器最终都会创建一个代表代码的字符串,然后使用 eval,这可以通过简单的警报语句来撤消,这有什么意义呢?
As a rule of thumb, do not use a obfuscator that uses eval since this will slow down your page, use a compressor that doesn't. This will provide obfuscation for newbies, anyone else will not be deterred by any obfuscator anyway.
Most obfuscators will create a strings representing the code in the end and then use eval, this can be undone by a simple alert statements, whats the point?
如果您想要简单的混淆和出色的压缩,我可以推荐 Yahoo 的 YUI Compressor。
If you want simple obfuscation and excellent compression, I can recommend the YUI Compressor from Yahoo.
对于那些寻找 - http://javascript-reference.info/javascript-obfuscators- review.htm - JS 混淆器的很好的概述
Check out For those looking - http://javascript-reference.info/javascript-obfuscators-review.htm - pretty good overview of JS obfuscators
我也会支持 YUI Compressor 的推荐,它工作得很好,可以压缩和混淆,还对 javascript 编码提出了建议。
I will second the recommendation for YUI Compressor as well, works very well and can compress and obfuscate, also makes recommendations on javascript coding.
我也投票给帕克。 有在线版本、独立版本,甚至还有控制台版本,当我构建 Web 应用程序时,我可以使用它来自动打包我的 JavaScript。
I vote for Packer as well. There are online versions, Standalone Versions, and even a Console Version that I use to Automagically pack my javascripts when I build my web apps.
尝试http://digua.sourceforge.net。
Try http://digua.sourceforge.net.
http://www.javascriptobfuscator.com/Default.aspx
http://ajaxian.com/archives/utility-javascript-obfuscator
http://www.javascriptobfuscator.com/Default.aspx
http://ajaxian.com/archives/utility-javascript-obfuscator