Live data from Hacker News

Why do browsers not allow non-readable javascript?

news.ycombinator.com

1–10 of 12 posts

Why do browsers not allow non-readable javascript?

#1
As more processing moves to the client side, would it not helpful to allow site admins to protect the source code in their Javascript?

Perhaps by encrypting the Javascript files and providing a mechanism for them to be decrypted by the browser internally?

Don't get me wrong, I'm all for open source and openness but for some companies it just does not fit the culture.

Re: Why do browsers not allow non-readable javascript?

#2
If the browser can decrypt it then it is a simple matter to get at the decrypted code.

If you want to make it really difficult to "steal" code just run it through a minifer. You'll never really be able to hide what a script is doing though. If you want logic not to be user-known and very likely user-modifiable you -must- make it server side. If this weren't the case DRM would actually work ;)

Re: Why do browsers not allow non-readable javascript?

#5
The one thing I've noticed about every single person so far who has asked me if I could help them "protect" their javascript is that there was nothing at all unique about it.

They've almost always reinvented some part of jQuery or a well know plugin and done it badly.

Re: Why do browsers not allow non-readable javascript?

#9
I'm all for hating on DRM, but those of you posting here saying that DRM doesn't work under any circumstance are being a bit disingenuous, I think.

Putting the ethical questions aside, if browsers allowed javascript encryption and company X has a program that "frombulates widgets" and they want to protect their code from their main competitor Y, such encryption would present a valuable obstacle, even if it may not be 100% impossible to crack.

Post reply on HN