Rewritten question:

I'm not asking a JavaScript-related question, but all "client" languages used on the web (HTML5, JavaScript, CSS, and so on). If I put JavaScript code (that is GPLed) on my website, and this website is accessible from anyone over the web, am I violating the GPL in some way?

What happens if I would like to sell the client-code (HTML, CSS, JavaScript) to someone? Do I need a different license in this case?

Isn't JavaScript (when used for websites) always open source? When you open a webpage you can always read the source.

Do I also need to release my server-side code if I'm selling a website which contains JavaScript GPLed code?

What happens if this website is partially accessible (a part is free and the other requires you to pay) but the GPLed code (the same part) is used on both sides of the website?

What if the GPLed code is only in a part of the website that requires you to pay to access it?

If I'm selling a website to a customer in this way:

  1. I'm selling you (one time fee) all client-related code (JavaScript, HTML and CSS)
  2. I'm not selling you the server-side code, you're renting it (I don't want to let you reuse my server-side code)

If I'm using some JavaScript GPLed code, am I violating something? (The website is accessible from anyone over the web.)

Edit 2:

Added a new specific question:

What if the website can work without server-side code, I mean, JavaScript is just calling some PHP pages that contains data in JSON format. Other people can build a website with the client side, but they will need to provide data. In this case JavaScript is calling the "PHP" code (but not the opposite) I think. In this case, am I violating GPL?

  • 4
    The ability to "see" the code has nothing to do with licensing so JavaScript is no different than anything else. You'd be best served by consulting a lawyer who is an expert in this specialty.
    – Sparky
    Commented Jul 26, 2011 at 14:37
  • For the javascript on a website, is that where you're specifically talking about GPL code? ie, is the code explicitly licensed under the GPL?
    – Philip
    Commented Jul 26, 2011 at 14:42
  • Well, I'm not selling any product I'm just asking this because I don't understand well how it works. I'm specifically asking if any client related language aren't already all "GPL" (you download the source any time you visit a webpage) Commented Jul 26, 2011 at 14:44
  • In a non-trivial application, your source code isn't just Javascript, it's also your server-side code. Do you want to release all of it to the public? Because that's what the GPL says. It doesn't say you can release some of it and still be compliant with the license. Commented Jul 26, 2011 at 15:11
  • 1
    planet.mysql.com/entry/?id=11940 Commented Jul 26, 2011 at 18:07

4 Answers 4


When it comes to GPL, the unit of release is the unit of licensing.

If your web site, and its javascript are a single thing that works together, then the whole has an effective license. If any part is GPL, the effective license of the whole is GPL. (This is not true for LGPL, MIT, etc.)

If you are hosting the web site, and your customers are buying access to the service, then you have not distributed or conveyed the server side code, thus the GPL is irrelevant. (The AGPL changes this, and asserts that Software as a service must have its source released.)

Javascript that is part of your application in not automatically licensed in any way. Strictly speaking, downloading the javascript to run it in the browser is copyright infringement. Of course, that is silly. There's probably an implied license to run the code, but that is all.

If you use a Javascript library, then you have to obey the license of that library. If that license is GPL, my understand is that that means your whole application is GPL. This is probably why jQuery has a dual license -- your choice, MIT or GPL. Without the option to use the MIT license, it could only be used by GPL apps.


First: You are entirely entitled to use Open Source code in commercial projects so long as you adhere to the license restrictions (that is primarily that you leave all attributions in place and that you make any changes available under a similar license).

The GPL is, I understand, one of the more restrictive licenses when it comes to trying to force it's licenses on other parts of a project. I don't think it's ever been tested in court but a generally the interpretation I've always seen is that if the GPL code is left in it's own separate modules which are just referenced (that is that they are treated as entirely stand alone products which you are just using), you should be fine.

If you're not sure about this though and/or want to be extra safe there are other less prescriptive licenses.

Second: Ability to see code and the rights to use it are entirely separate. I can't go and take JavaScript off off any site and use it just because I can see it. If I got access to the Windows source, even legally, that doesn't make it mine. The web makes it necessary that a lot of code is visible, you can still license it how you want.

Third: In terms of the license the rest of the site is under, it's highly unlikely that your client will be happy paying you for something then you making it open source. Aside from the basic "why have we paid for something you've just given away", it will likely have consequences for design and branding and allowing someone else to borrow elements of their corporate identity. If you're selling it to them then they will want it to be theirs. If you are going to sell them bits of it though you do need to tell them that there is OSS in there as you can't sell that, just other code which uses that.

Fourth: That's a very odd model selling one bit of the code and renting the other. They would seem to be so heavily interdependent that one is largely worthless without the other. I suppose technically they might take the front end design you've done and patch it into something else but generally when that happens people just start over.

Given that the two parts aren't really that useful without each other, I'd propose that they pay for customisation to a software as a service product which you own. That is you own all the code, you just customise it to their specification (that is brand the front end their way). Makes it far neater and simpler.

  • Mhhh now I have a doubt: when I createa a website for a customer, who is the customer: the person to who I sell my website or the users that will access to it? If I sell all the website as a GPL product (with sources so) to my customer, do I need to release the source code even to all people navigating on that website? Commented Jul 26, 2011 at 16:04
  • @Fire-Dragon-DoL - Your customer is the person who pays your bills. If you GPL your code you need to make it publicly available to everyone, everywhere, not just your customer and / or users (and everyone has the rights to reuse that code). Commented Jul 26, 2011 at 16:06
  • On the last part (your explaination is really clever, thanks): Given that the two parts aren't really that useful without each othe: in this case if I'm using GPLed code should I still release the sources? Because I can read your sentence as "I'm selling you the service of customizing the software, not the software itself which is still mine" Commented Jul 26, 2011 at 16:07
  • To answer to your last comment: I'm not sure, I mean the GPL says you must release the code with your software, but if a person is navigating on my website I'm not giving him my program, he is using my program, I think it's different. GPL doesn't say you have to release your program. Commented Jul 26, 2011 at 16:09
  • 1
    @Jon You only need to give the source to the people who got the binary; not to anyone who asks. (Of course, they get the right to give to to whomever they want, but you are not required to do so.) Commented Jul 26, 2011 at 18:45

Generally speaking, if you are using GPL code anywhere in your project, and you redistribute your project (i.e. sell it or give it to others) you must release the source code of your project to the public in its entirety in order to be compliant with the GPL license.

If you are providing your own public-facing website as a service using GPL code server-side, you might be OK, as this is not considered redistribution.

Javascript code in the browser seems like a grey area to me. Technically, you are redistributing the GPL code to everyone's browser, which would trigger the requirement to release your own source.

Edit: To prove my point, I will now include text from the licensing FAQ of the ExtJS website. ExtJs is a Javascript framework licensed under the GPL. This is their interpretation of how the license works with respect to their framework (italics mine):

Derived Works
When a software program calls code that is licensed under the GPLv3, then that software program becomes a derived work of the GPL’d code and hence subject to the GPLv3 copyright license. If the software program is then “conveyed” to a user, the GPLv3 requires that the source code to that software program also be “conveyed.” “Conveyance” for a web application is triggered when a user outside the legal entity that created the application uses the application.

The Definition of a Software Program
For software programs built using today’s web architectures that use remote network-based service interfaces for internal communication instead of traditional static or dynamic linking, the relevant software program is the totality of the application code, including code executed on the server and code executed on the client, provided that the server code is integral to the application.

Let’s say that the application has a front-end (that generates web pages linked to Ext JS JavaScript) that communicates over JSON/HTTP with a backend service. This backend service contains approval and validation logic for this application alone. Even if only the front-end uses Ext JS code, you should consider that the combination of front and back ends constitutes the application, and the source code for both back and front end would need to be provided to the application’s end users under GPLv3 if the application is used by an end-user who is not part of the same legal entity that holds the GPLv3 license to the Ext JS code.

  • 2
    This is wrong, the GPL doesn't work this way. Including a link to a GPL'd JS file in the output of your PHP code doesn't somehow make your PHP code open source.
    – user229044
    Commented Jul 26, 2011 at 16:44
  • @meager: See my edit. Commented Jul 26, 2011 at 17:51
  • That just seems entirely wrong. What if my back-end directed to a third party site which used GPL'd JS files? Do I then have to open source my entire application? I don't think this would hold up in any court. Sorry.
    – Rob
    Commented Jul 27, 2011 at 4:54

For a website with client-side javascript, they still own the code. If you were to simply take that code and use it as your own, that would probably be IP infringement. I guess I don't know if they don't include a license with it. There are un-enforceability issues too. Talk to a lawyer I guess, but they're probably not going to tell you anything useful.

Projects with a mix of licenses are complicated. GPL'd code that interacts with other libraries, presumably including server-side back ends, requires them to be GPL'd as well. Other open source licenses are less stringent, like the LGPL, and the BSD license.

And no, if you don't want him to reuse your php code, then that doesn't fit into the GPL model. If you release your code under GPL, then you are OBLIGATED to hand over the source code.

So it sounds like you're making a website for someone and you don't want to hand out your code to anyone. Why are you looking at open source at all? If it's open source, you're giving away the code.

  • I'm not selling anything at the moment, I'm just asking this because I think a website as 2 different parts, the client website and the server website. The first part is free while the second part is not. If a website is "opensource" should you release the server-side source code? I find a bit difficult, it will create disasters over security! Commented Jul 26, 2011 at 15:06
  • 2
    This isn't right. If part of a project is GPL, the entire project must be released under a GPL compatible license (assuming it is all considered the same program, and can't be broken up into pieces). And being GPL does not prevent you from selling it, it just means that you must provide the source with any binaries, and cannot restrict further redistribution.
    – KeithB
    Commented Jul 26, 2011 at 15:11
  • What if the website can work without server side code, I mean, javascript is just calling some php pages that contains datas in json format. Other people can build a website with the client side, but they will need to provide datas. In this case javascript is calling the "php" code (but not the opposite) I think. In this case, am I violating GPL? Commented Jul 26, 2011 at 15:21
  • @KeithB ACK! You're right. I was thinking of the GTK and SDL, but those are LGPL. Thanks.
    – Philip
    Commented Jul 26, 2011 at 15:33
  • Yea LPGL is a good license, I would like to understand GPL by the way because... well, I think it's harder to understand Commented Jul 26, 2011 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.