3

Possible Duplicate:
What are some good ways to prevent people from copying my source code?

I am looking into ways to 'encrypt' my HTML and CSS code so that a visitor cannot simply 'View Source' and copy it.

7
  • 12
    Short answer - you can't. Commented Jul 14, 2010 at 14:43
  • Haha. You can't.. per se. The only option that I would think of would be obfuscation.. But, is it really worth that? Commented Jul 14, 2010 at 14:44
  • 4
    Welcome to the Internet. Commented Jul 14, 2010 at 14:49
  • 7
    Why the down votes? Customers ask me this very question every once in a while. Commented Jul 14, 2010 at 14:52
  • 2
    Presumably because it's a question that has been asked many times before here and on every question site or mailing list, one that can't be answered by the very nature of the medium, but one that people keep applying wrong-headed ‘solutions’ to (like trying to disable right-click or hiding the page content in obfuscated JavaScript) that invariably have only a negative impact (on accesibility, usability, SEO). Commented Jul 14, 2010 at 15:09

3 Answers 3

11

That's not possible; you should copyright your code instead if you are worried.

Or you may want to have a look at:

Obfuscated Code

Sign up to request clarification or add additional context in comments.

2 Comments

And the good news is that in most countries the pages & code we produce is copyright by default!
The bad news is that you can't afford to enforce your copyright.
4

There aren't any. The best you could do is some tool that will minify or obfuscate your javascript code. However, there's no way to make it truly secure. Encryption implies decryption on the client side, which exposes everything to the user.

Comments

3

So why is this not possible? HTML, CSS, and Javascript are all client-based. Meaning that you have to give the user your code, and it is processed on his machine. You can't simultaneously show someone the code and prevent him from seeing it.
Depending on exactly what it is you want to protect, you may want to look into server-based technologies like PHP or ASP.

You also of course have the option of just doing a really good job to build the reputation of you/your company. After all, imitation is the sincerest form of flattery. Or doing a really crappy job so that nobody wants to copy you.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.