Take the 2-minute tour ×

If I use GPL-licensed JavaScript components on my website, would it be considered as a release to the public (as client-side code of the components is loaded to users' browsers via http) and I have to "open-source" the whole website?

So, can we say that the usage of JavaScript components on a website is distribution of the code and it involves the distribution of the whole website code?

Hope, the question is clear and you can help me to understand this aspect of GPL.

share|improve this question

closed as off topic by Robert Harvey May 7 '13 at 16:25


Can someone answer this properly? The question is, when I use GPL'd JavaScript from my company's proprietary JavaScript, does the GPL then infect our proprietary JavaScript, and perhaps the whole web app? Do we then have to release the whole client-side portion of the app as GPL if it's made available to customers? The fact that we have to ask this really shows how crazy the GPL is, in my opinion. I'm pretty sure the answer is "yes, your whole app is infected", as that's the case with every other programming language. Don't release javascript libraries under the GPL for general use. –  Sam Watkins May 23 '12 at 0:22

7 Answers 7

I am not a lawyer. I have talked to lawyers about using the GPL and LGPL for code to be interpreted / dynamically linked into non-free software. We all got big headaches. The question isn't just whether you have to release the rest of your site under GPL. It's whether a non-free browser can legally run GPL code.

My best non-legal advice is to never try to use the GPL on Javascript code. I'd never release a Javascript library under GPL, and if I found some code I wanted to use I'd try to get the author to give me an exception. The LGPL may be a better choice, but that license is so complex I suggest avoiding it as well.

The FSF themselves have an answer for you in their FAQ If a programming language interpreter has a license that is incompatible with the GPL, can I run GPL-covered programs on it?. That answer itself is frustratingly ambiguous, but it suggests paths where you could run GPL code in a non-GPL browser. You may also find the FSF essay The Javascript Trap interesting, although again it doesn't really give a clear answer to your question.

For context, it helps to remember that the GPL and LPGL were written in the Unix era when most everything was statically linked. No dynamic linking, no interpreted languages where the scripts themselves were considered valuable intellectual property, etc.

share|improve this answer
IANAL, but I'd say that since the browser and the script are not derivative works of each other, and the combination isn't being distributed, then any browser can run GPL code. –  Mr. Shiny and New 安宇 Sep 28 '09 at 17:37
It's perfectly OK to run GPL software (Gimp for example) on Windows. How would GPL Javascript code in Internet Explorer be any different? That FAQ question from the FSF you linked seems perfectly clear and not ambiguous at all. –  Pointy Sep 29 '10 at 15:15
Because Javascript dynamically hooks into / links into DOM events provided by IE. I really think its an extreme case, but that's what the FSF seem to argue in "The Javascript Trap" essay. –  DeepSpace101 Feb 16 '12 at 22:49
No, Sid. That's not what's argued in "The JavaScript Trap." That essay is all about running non-free JavaScript code, not about running a non-free browser. Where did you get that from? And got 2 upvotes on top of that?? –  n2liquid - Guilherme Vieira Dec 6 '13 at 10:13

You have distributed the JavaScript library to the user; you are required to comply with the GPL's requirements on distribution then. Whether this requires you to distribute the rest of the website is where things get complicated - I'd advise you to talk with a competent lawyer about your exact situation if you're even thinking about going that route, and keep in mind that this is at least violating the spirit of the licence, whether or not it violates the letter of the license as well.

share|improve this answer
+1 — talk to a lawyer. –  Quentin Aug 6 '09 at 15:05
@Quentin: why do we need to talk to a layer every time about this very same issue? It's an FAQ by now. –  Dan Dascalescu Dec 22 at 10:42

Your app + GPL'd library + release -> open source GPL'd app.

This is the intention of the FSF and the GPL, and it applies regardless of what programming language you are using.

A GPL'd JavaScript lib will infect all your JavaScript code, and possibly even your HTML and page content.

So please don't release JavaScript libs under the GPL, if you intend them for general use.

In my opinion, the GPL is an anachronistic boil on the ass of free software.

share|improve this answer
GPL'd code cannot be freely mixed with various other copyleft code, such as Apache licensed code. If you want a free license, look at the MIT or BSD licenses. Code under these licenses may be used freely in any software project. This is good! You could also release your code to the public domain, like I do. I would rather have proprietary than GPL software. At least it doesn't pretend to be free, and suck so much effort away from true free software. If you want a free kernel, get rid of Linux and look at *BSD. Linux can never be free software, until the GPL is ruled unlawful. –  Sam Watkins May 23 '12 at 1:06
What about this apparent exception for JavaScript listed in the GPL FAQ? gnu.org/licenses/gpl-faq.html#WMS –  ioSamurai Jun 26 '12 at 14:16
That exception is only valid if the author adds it to the license. Anyway, it still contaminates your other javascript code. Might as well add "As a special exception, forget about the GPL, and do whatever you like with this code". I call it "public domain". –  Sam Watkins Jun 28 '12 at 0:42

This guy wrote an article about it: http://stuck-in-windows.blogspot.com/2009/02/fud-over-javascript-and-gpl.html

In his article, he cites the gnu website FAQ, which has Q&A:



The FAQ then references the GNU Affero GPL which does require the release of all website source code.

share|improve this answer
Javascript is different than backend web code though, because it is "distributed" to the end user by being downloaded. I would interpret this Q&A as referring to back-end code which isn't distributed. –  Nils Mar 28 '12 at 19:54

This does definitely get complicated. I'll give you an example. What if you're using jQuery's GPL license (I know it's dual licensed, but let's ignore that for just a sec).

Google has a public distribution of jQuery (among other javascript frameworks) that they distribute on their CDN, for example:

So in this case, you're not the one that is distributing the javascript library to the user, google is ;-)

please note: as @bdonlan describes, only an experienced lawyer should be the one to really weigh in on this. I only contributed this answer to provide context for things you can speak to the lawyer about.

share|improve this answer
Ad „So in this case, you're not the one that is distributing the javascript library to the user, google is“ I does not matter who is distributing – your code depends on GPL-licensed library (it is like using C/C++ header files) so it should be also under GPL. So your client-side javascript is under GPL but it is question, if also your server side code should be GPL-licensed. –  Franta Aug 29 '11 at 14:24

And just to add more fuel to the fire...

Reading the gpl v3 it is clear that if you include a gpl'd work, you need to provide the source with the license text at the top of the file and the copyright statement.

So if I strip comments and whitespace from the file and shorten variable names, then 'distribute' it to someone's browser (in source form of course) I would probably be in violation of the license. BTW, a solution might be a binary uuid that stands for the appropriate licenses for the mangled files. Thoughts?

If I provide the source of the library and my own 'source' using the library with a gpl stmt on it, does delivering it to the browser constitute providing the source freely?

I think there are enough loopholes in this to make the license unenforceable.

my 2cents/ not a lawyer.

share|improve this answer

For e.g. Magento uses ExtJS which is under GPL v3. Now, when Magento is downloaded and installed by shopping-store-owners, you mean store-owners have to give a link to their 'whole-website-source' along with their Products ? Funny Lol

So In my opinion, a Javascript library licensed under GPL v3 is good for any project unless you are trying to modify the Javascript library and selling it commercially or related commercial-services.

share|improve this answer
ExtJS is also licensed commercially though... do you know whether Magento uses the paid version? I think the ExtJS team would argue you DO have to open-source other pieces if you use the gplv3 version, that's part of how they get people to pay. –  Nils Mar 28 '12 at 19:55
The GPL does not forbid you to charge for your library, but it does not allow you to restrict the buyer to continue distributing it. –  Dave Van den Eynde Apr 13 '12 at 12:48
