This is the oldest question there ever was. The simple answer is: "You CAN'T hide your source code, period." However, I realize there are some people who would like to try. This FAQ will not criticize those users, it will provide information on how they can make it a little harder for users to look at their code. Elders - do not flame this FAQ. It is a very heavily requested topic whether it is right or not to hide your source code.
The first step is to remove the context menu from your webpage. The following code will stop the context menu from popping up when a user right-clicks the page. Insert this code after your <head> tag.
Another method is to load a Macromedia Flash file in a hidden frame. This doesn't mean to put an object tag in a hidden frame and load the Flash file that way, this means to load the actual SWF in the hidden frame. This has been known to disable the View->Source option in Internet Explorer's menu bar. I have not tested this with IE6 however.
To further protect your code, you may want to "encrypt" it using a JavaScript powered binary ecrypter by Matthew Tong. It's very nicely done and very hard to decipher (assuming the user doesn't know where to find the decrypting code), but it's also pretty slow when it decrypts.
The link is: http://javascript.internet.com/miscellaneous/matts-encrypter.html
As previously stated, hiding your source code will probably never be 100% possible, and the internet is (for the most part) designed to be open source. Please use the information in this FAQ only as a reference, not a tutorial.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.