Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to hide your source code

Hiding source code

How to hide your source code

by  Supra  Posted    (Edited  )
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.

[green]
<script>
<!--
document.oncontextmenu = new Function("return false");
//-->
</script>
[/green]

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.
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top