I tried different obfuscation tools for JavaScript, but when I use resultant it does not work.
I removed all comments, single-line and multi-line comments, and beautified the code in order to have proper semi-colon and proper formatting.
My question is : What are the prerequisites before obfuscating the code?
If your code doesn't have any errors or warnings when debugging, then it should obfuscate. Read more about the tool you're using to make sure it supports your JavaScript implementation.
If your code can run in relative isolation as below, it should be able to obfuscate very well...
Example:
(function(window, $){
//your code here
//create global namespace - expose classes/methods
window.MyProject = {
someMethod: someInternalMethodToExpose
SomeClassName: SomeClass
};
//internal stuff
function someInternalMethodToExpose() {
...
}
//constructor function
function SomeClass() {
...
}
SomeClass.prototype.someMethod = function() {
...
}
}(window || this, jQuery));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.