Join 3,372 readers in helping fund MetaFilter (Hide)


How can I protect my javascript code from being stolen?
February 15, 2012 4:02 AM   Subscribe

I've written some customizable interactive activity templates in javascript that work on tablets and I want to sell to publishers. How do I prevent anyone from stealing and re-using the code?

There's nothing specifically unique or patentable in it. I've just simply spent a lot of hours customizing something that would be very useful to educational publishers fulfilling a very specific need. Most publishers don't want to spend the money to do it on their own. This is just the kind of thing they would buy.

Thing is, i've done it using jquery / JS. Do I have any other options other than obfuscation?
posted by postergeist to Technology (9 answers total) 1 user marked this as a favorite
 
Not really, not if it's client-side JS. Even if you obfuscate it, people could fairly easily replicate it simply by observing what it does.

The usual solution is to offer great docs, support and maintenance so that it becomes challenging in the long run for the pirates to use it. Besides, medium to large companies always need these three resources and don't steal code in this price class.

Additionally, you could add a mechanism that makes it easier for you to detect sites that are using your code and see if they have a license or not. Then it's just a matter or involving a lawyer.

There are similar opinions on Stack Overflow on the limitations of obfuscation.
posted by Foci for Analysis at 4:28 AM on February 15, 2012 [3 favorites]


Forgot: it's pretty common to offer tiered support where you have small (very basic stuff, included in the price of the solution), medium and large packages where customers are offered increasingly generous support solutions. I've seen people pull this of with even basic wordpress plugins so it should work for you.
posted by Foci for Analysis at 4:33 AM on February 15, 2012 [1 favorite]


Do I have any other options other than obfuscation?

Lawyers.

(Doesn't matter if your software is patentable; you can still retain copyright.)
posted by ook at 6:59 AM on February 15, 2012


Lawyers.... nah.
posted by postergeist at 8:07 AM on February 15, 2012


You cannot effectively protect this content by technical means. Because JavaScript is not a compiled language, the source can be grabbed and used by anyone using the code. You can use something lie packer to do obfuscation, but in the end, your customer has the working code. You can add checks in the code if you like, maybe to a remote server of yours to monitor usage, but then you have additional latency as your code needs to do extra network traffic to determine if the usage is licensed.

So the challenge to you is to do this at a cultural and human level. Make it absolutely clear you own copyright, and you are selling licenses for a particular purpose, and beyond that more services should be paid for.

And you can use lawyers, you know, like the music business and movie business.
posted by artlung at 8:09 AM on February 15, 2012


Lawyers.... nah.

Doesn't have to be, like, scary lawyers. A license for your code and a copyright notice wouldn't cost that much to get written up, and is going to be a lot more protection than code obfuscation. (I work in almost exactly the same industry niche. I agree with Foci for Analysis that the publishers you're hoping to work with are unlikely to try to rip you off, provided you've made at least a token effort at legally preventing them from doing so. And most will strongly prefer unobfuscated code they can tweak if need be.)
posted by ook at 8:40 AM on February 15, 2012


Most publishers don't want to spend the money to do it on their own. This is just the kind of thing they would buy.

Why do you need more than this? It's been the basis of selling products and services at least since the beginning of the Industrial Age. How are you planning on selling the code?

As for stealing, I'm not aware of any tablets that have a "view source" option, or Firebug, so one way of obfuscating is to host your code on a site that enforces user agent-based page rendering. You know, so tablets only (more or less) see your tablet code.
posted by rhizome at 9:32 AM on February 15, 2012


[O]ne way of obfuscating is to host your code on a site that enforces user agent-based page rendering. You know, so tablets only (more or less) see your tablet code.

Except it's trivial to change the User-Agent sent by your browser to the servers it hits, so anyone can pretend to be using a tablet when they're really on their regular computer. Yoink!
posted by letourneau at 9:58 AM on February 15, 2012


Which is why I called it merely, "obfuscating."
posted by rhizome at 10:25 AM on February 15, 2012


« Older My husband and I own a small h...   |  Docofi: Human Planet, One Gian... Newer »
This thread is closed to new comments.