Encrypt JavaScript source code


with Encrypt HTML source v.2.0


Encrypt JavaScript protect

You can encrypt Javascript and VBscript code with the program, no matter if scripts are directly included in html files or they are stored in separate .js / .vbs files.
Note that if your scripts are stored in external .js / .vbs files, some of the additional protection options can't be used for them. However you can use all the additional options when you protect the html files that use your scripts. A detailed explanation of all the peculiarities in regard to Javascript protection is available in the help file.



You should observe the following when you protect Javascript or VBscript code:

- some web counters may be problematic - after encryption of the counter javascript code, the counter may become invisible or it may not appear on the same place in your page. To avoid this problem, put the counter code in a separate .js file and do not encrypt it.


- there should be no html entities ( like   ) or comments inside script blocks.
You should use the correct form to insert comments inside your scripts.
For JavaScript:
 // this comment is OK
or
 /* this is another comment which is also OK */
For VBScript:
 ' this is a correct VBScript comment

Having html style comment tags like <!--this comment is not OK --> inside a script block is incorrect and may cause problems after you encrypt Javascript or VBScript code.
Of course the commonly used <!-- in the beginning and //--> at the end of a script block are OK, but useless. Their only purpose is to hide the script source from old browsers that may not understand it and as a result display it as a text.

But such browsers practically do not exist since many years.

- try to use good coding practices.
Terminate each line with ; . Although not a mandatory, this makes the code steady and simplifies debugging.
Don't omit brackets. Although there will be no difference in execution between
if (condition) myVar = 'xxxx';
and
if (condition) {myVar = 'xxxx'};
, the second variant is preferable.



- before you encrypt Javascript source, make sure the original code is error - free. Almost all browsers has the ability to supress script errors and not notify the user for them. This is very useful when you browse the web, but you should turn this feature off while testing your code.