Related topics:

Password protect html,encrypt source,hide html code - the basics [Home]

Javascript encryption [FAQ]

javascript encryption-protect javascript encrypt source code What can you offer in regard to

javascript encryption


You can encrypt javascript (.js) files. It is possible to use javascript encryption with HTML Guardian.
You can secure either external script files or scripts used in your pages internally.
An external javascript is a file stored with a .js extension - such files usually contain script functions called from the html page that uses the script file.
Scripts used internally are sections of the html file enclosed within <script..> </script> tags.
Scripts may utilize any browser or OS supported scripting language. The most widely used scripting languages are JavaScript and VBScript.
HTML Guardian can encrypt both Javascript and VBScript files (.js / .vbs) or script sections written in any of those programming languages. It can also protect scripts written in php and some other, not so popular scripting programming languages.

Javascript encryption can be used for many different purposes, not only to protect script source. For example, you may encrypt a simple javascript file with several protection options like disable right click, disable printing, disable print screen, disable text selection etc. Those security options will be applied automatically to all html files which contain a reference to the encrypted javascript file, so they don't have to be set on a per file basis. This is a convenient way to protect different files with predefined sets of security options, by simply putting a reference to the corresponding script file.

As noted, each file protected by HTML Guardian is first compressed and then encrypted. There are two source code compression methods available - Low and High source compression. It is important to understand that the successfull javascript encryption depends on proper code compression. For html code, High code compression is successfull in 99.5 % of the cases, but this is not the case for script code - certain problematic pieces of code may cause errors in compression. The most common reason for problems are omitted { } brackets. For example if instead of the correct form
if (a > b) {alert('a is bigger')};
you use the incorrect form
if (a > b) alert('a is bigger');
this may cause a High compression failure, which will result in a non - working compressed script. Of course, the protected script will not work either. If you use the proper form with { } brackets, there will be no problems.
If your scripts contain such problematic pieces of code, always use Low source code compression when encryptyng them ( you can set the level to be used from the Configuration --> General Settings window ).
Always use Low compression if you use scripts taken from some website with code samples - in the vast majority of cases those samples contain pieces of code with an incorrect syntax. Actually as those samples are freely available for anyone, there is no need to perform javascript encryption on them.

Go Back
Go back Next

   © 1997-2023, ProtWare Inc. All rights reserved.