As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
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
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:
http://www.dev411.com/dojo/javascript_compressor/
http://javascriptcompressor.com/Default.aspx
http://developer.yahoo.com/yui/compressor/
You can use /packer/
http://dean.edwards.name/packer/
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?
If you want simple obfuscation and excellent compression, I can recommend the YUI Compressor from Yahoo.
Check out For those looking - http://javascript-reference.info/javascript-obfuscators-review.htm - pretty good overview of JS obfuscators
I will second the recommendation for YUI Compressor as well, works very well and can compress and obfuscate, also makes recommendations on javascript coding.
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.
Try http://digua.sourceforge.net.
http://www.javascriptobfuscator.com/Default.aspx
http://ajaxian.com/archives/utility-javascript-obfuscator
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I occasionally write JavaScript code. I am interested in minifying it for better performance, but I don't plan to spend to much time on that, especially in testing the minified result.
I found this online service:
http://www.lotterypost.com/js-compress.aspx
So a couple questions:
Is it reliable?
Microsoft AJAX minifier vs. YUI Compressor, what's the best option?
Any other similar online tool to recommend (and why is it better than the above link)?
Google's Closure Compiler
is an excellent Javascript minifier and compiler. It analyzes the code and reports the detectable errors. It removes redundant space and unreferenced code, and renames objects to shortest possible names. You just need to compile together all Javascript files that belong to one HTML page.
That link you post happens to be the one that I use too.
Use the MS AJAX Minifer. It's way better than the yui one. besides:
http://stephenwalther.com/blog/archive/2009/10/16/using-the-new-microsoft-ajax-minifier.aspx:
The Microsoft Ajax team (I work on
this team) has been using this tool
internally for a number of years. For
example, we use the Microsoft Ajax
Minifier to minify the Microsoft Ajax
Library before publishing it.
Well if you don't trust me, run your source code (if you don't have an actual source code to test, just grab the source at http://code.jquery.com/jquery-1.6.2.js) through both and see which is more "minified".
==
Google has the Google Closure Compiler but it analyzes your code and removes unreferenced code (to furthur reduce the size of the resultant file). However usually this is not what you want because even though the functions/variables are not referenced within that file, it may be referenced from your other js files that make up your site)
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
What is the best open source/free HTML5/CSS3/JavaScript IDE?
Thank you!!!
Most of the time when I write code I am programming C# applications using Visual Studio, which is my favorite IDE. However, when it comes to Javascript VS is quite poor. It does not support collapse to definitions (AKA code folding in other IDEs / editors), does not support code outlining and also has a very primitive and most of the times useless autocomplete.
Because of that, at some point I have started to search alternative tools for JS programming and the best I came across was Aptana Studio. It also has support for HTML and CSS (as well as for some server side languages like Ruby, PHP, Phyton), but I have only used it for JS and that is an area where it shines. It has very good code outlining and one of the best autocomplete implementations I have ever seen for Javascript (even thought it is still improvable).
Aptana Studio is based Eclipse and is available as a plugin or as a full package version. On their site they are saying that the next version is going to totally independent from Eclipse, which would make it a lot more light weight and more performant. However, the current Beta version of Aptana Studio 3 is still based on Eclipse.
You can find more on Aptana Studio 3 on the official page: http://aptana.com/products/studio3
(G)Vim of course. While it might look spartanic at first, it's extremely powerful once you've become familiar with the way it works.
The answers are likely to be subjective, but here are some choices:
KompoZer
Aptana
Amaya
Here are the links: KompoZer, Aptana, Amaya.
This also may help: an extensive comparison of HTML Editors.
I use Komodo Edit. The latest version has code completion for HTML5 and CSS3, the JavaScript code completion can be adjusted depending on which JS libraries you use (eg. jQuery, prototype, YUI).
Free and open-source? - NetBeans.
There is Sublime Text 2 http://www.sublimetext.com/2 after few years with Aptana... I enjoy using it.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I need a complex js obfuscator so that the js file won't be easy to reverse with a public tool like http://jsbeautifier.org/
You may try jscrambler.com. It's the only one I know that could help you. Check what it does.
You can shrink variable names when you use Dean Edward's packer. While this can be reversed, it does leave you with pretty unreadable code as the variables aren't easily identifiable.
http://dean.edwards.name/packer/
Use Packer algo http://dean.edwards.name/packer/
do check the options 'Base62 encode' and 'shrink variables'. This will obfuscate the code to a certain limit but still, as #musicfreak said, anyone who is determined can still make out the code.
If you use a JavaScript library, consider Dojo Toolkit which is compatible (after minor modifications) with the Closure Compiler's Advanced mode compilation.
http://dojo-toolkit.33424.n3.nabble.com/file/n2636749/Using_the_Dojo_Toolkit_with_the_Closure_Compiler.pdf?by-user=t
Code compiled with Closure Advanced mode is almost impossible to reverse-engineer, even passing through a beautifier, as the entire code base (includinhg the library) is obfuscated. It is also 25% small on average.
JavaScript code that is merely minified (YUI Compressor, Uglify etc.) is easy to reverse-engineer after passing through a beautifier.
Google Closure Compiler.
http://code.google.com/closure/compiler/
I use it on advanced. Read the docs about exporting public methods etc.
http://code.google.com/closure/compiler/docs/api-tutorial3.html
It rocks.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Between Yahoo! UI Compressor, Dean Edwards Packer and jsmin, which produces better results, both in terms of resulting footprint and fewer errors when obfuscating.
A great way to compare the best compressors is The JavaScript CompressorRater by Arthur Blake.
What you're usually interested in is the size after compressing with GZIP (you should configure your web server to perform the compression).
The best results are usually from the YUI Compressor or Dojo ShrinkSafe. The differences were so small that after a while I stopped comparing and I just use the YUI Compressor.
EDIT:
since the original time this question was asked, 2 new minifiers have been released. They're both usually at least as good as, if not better than, the YUI Compressor.
Google's Closure Compiler. Includes an aggressive advanced optimization mode that's sometimes applicable.
Microsoft's Ajax Minifier (search this page for "minifier")
EDIT 2:
UglifyJS, chosen by the jQuery team for the official 1.5 release
Better is a bit subjective here, since there are multiple factors to consider (even beyond those you list):
Compressed size doesn't tell the whole story, since an aggressive compressor can result in slower run-time performance due to the additional time needed to run unpacking code prior to browser interpretation.
Errors are easiest to avoid when you control the input code - judicious use of semicolons goes a long way. Run JSLint over your code, and fix any problems reported.
The style and size of the code itself will affect the results, of course.
And finally, it's worth keeping in mind that server-side gzip compression will always result in a smaller download than any code compression, although some code compression tools will combine with gzip more effectively.
My recommendation is to run the code you intend to compress through several compressors (an automated comparison tool such as CompressorRater helps...), and choose based on the results - remembering to test, profile and compare the actual page load times afterward.
Definitely check out Dojo Shrinksafe. It was reworked recently and apparently the performance has been improved.
Full disclosure, I'm behind this: http://www.toptensoftware.com/minime which does minification, obfuscation and a reasonable set of lint style checks. Currently it produces smaller output than Yui, not quite as good as Closure.
This is an old question and the Google Closure Compiler didn't exist then. I haven't used it yet, but it looks really good.
As a Mootools user, I notice that Mootools has replaced Dean Edwards' Packer by YUI Compressor. I also remember there was a discussion on Ajaxian.com where Julien (Compressor author) pointed out the areas where YUI Compressor did better. I used Compressor and have never seen any problem, but I have never studied to which produces fewer error when obfuscating.
YUI Compressor compresses more safely and compactly than Packer does. I believe Packer needs the JavaScript to be perfectly formed otherwise it will cause a JavaScript error when the script is loaded. Still, regardless of which you use, you'll get the biggest performance increase by Gzipping your file.
There's also a port of the YUICompress for .NET (which includes a build task for TFS) on Codeplex.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I am looking for a reference card for JavaScript - for example a summary of syntax and methods parameters. Google gives me lots of choices. What is a good one?
Actually, the one I use is the first hit on a Google search - Added Bytes Cheat Sheet .
Danny Goodman's JavaScript and Browser Objects Quick Reference is quite useful.
Devguru is a very good one that I use when in doubt.
If you don't mind spending a bit of money The VisiBone products are well worth the outlay!
VisiBone Javascript
For basic stuff I recommend W3Schools. It's not great but it's an ok beginning. For advanced stuff I recommend the Mozilla documentation. For on the fly prototyping I recommend a JavaScript Shell which can allow you to test what methods are available by doing something like props(object) which shows what properties (fields, methods) an object has.
Personally, I like the O'Reilly pocket reference books for stuff like this, they are inexpensive and come in handy here and there.
But, if you are looking for something online, I usually find a lot of good basic javascript (and HTML/CSS/etc..) stuff on w3schools.
You may find a lot of JavaScript cheat sheets at TechPosters website.
This is new, but very good: Encycode JavaScript Cheat Sheet