13

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?

Peter Mortensen
  • 1,050
  • 2
  • 12
  • 14
  • 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 Jul 26 '11 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 Jul 26 '11 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) – Francesco Belladonna Jul 26 '11 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. – Robert Harvey Jul 26 '11 at 15:11
  • @Robert I believe the GPL licence affects **derivative** code. Including a GPL'd library in your project doesn't somehow make the entire thing open source. Otherwise developing closed-source applications for Linux would be impossible. If you use a GPL'd JS library your code is still your own; If you modify the library the modified library is GPL'd. – user229044 Jul 26 '11 at 16:42
  • In any case, it is this kind of confusion that makes the GPL such an aggravating license. See also http://stackoverflow.com/questions/1239470/restrictions-of-gpl-on-javascript-libraries – Robert Harvey Jul 26 '11 at 17:25
  • possible duplicate of [How is client-side javascript covered by the GPL?](http://programmers.stackexchange.com/questions/62869/how-is-client-side-javascript-covered-by-the-gpl) – Robert Harvey Jul 26 '11 at 17:34
  • http://stuck-in-windows.blogspot.com/2009/02/fud-over-javascript-and-gpl.html – Robert Harvey Jul 26 '11 at 17:37
  • 1
    http://planet.mysql.com/entry/?id=11940 – Robert Harvey Jul 26 '11 at 18:07
  • @meagar A program that links a GPL'd library is a derivative work of the program's source code + the library. In that case the GPL applies to the collective work, and all source for that work must be made available. – Sean McMillan Jul 26 '11 at 18:42
  • @Sean No, linking to a library is not creating a derivation of it in any interpretation of the meaning. Sorry. – Rob Jul 27 '11 at 04:50
  • @Rob: I don't know about *web linking*, but the FSF has treated bot static and dynamic linking of GPL'd libraries as creating derived works for a long time. See http://www.gnu.org/licenses/why-not-lgpl.html , especially "At least one application program is free software today specifically because that was necessary for using Readline." – Sean McMillan Jul 27 '11 at 13:50
  • "Isn't JavaScript (when used for websites) always open source? When you open a webpage you can always read the source." No. That's not what "Open Source" means. See definition at http://programmers.stackexchange.com/questions/21907/open-source-but-not-free-software-or-vice-versa. – TRiG Sep 06 '11 at 17:25

4 Answers4

4

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.

Jon Hopkins
  • 22,734
  • 11
  • 90
  • 137
  • 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? – Francesco Belladonna Jul 26 '11 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). – Jon Hopkins Jul 26 '11 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" – Francesco Belladonna Jul 26 '11 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. – Francesco Belladonna Jul 26 '11 at 16:09
  • @Fire-Dragon-DoL - I would say (and I'm not a lawyer), that if you keep the GPL sections of the code in separate libraries and just call them without changing them at all then you're probably fine. If you make any changes to them or integrate them in such a way that the line between what's your code and what's theirs, you probably need to GPL the whole thing and release it. – Jon Hopkins Jul 26 '11 at 16:11
  • @Fire-Dragon-DoL - Publishing it on the web is releasing it. If you put it on the web, you need to publish the source. – Jon Hopkins Jul 26 '11 at 16:12
  • 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.) – Sean McMillan Jul 26 '11 at 18:45
  • If that is true, there aren't any trouble in selling some small website as GPLed programs to a customer. – Francesco Belladonna Jul 26 '11 at 18:51
  • @Sean - So you can build a public facing website on OS technology, modify what you want and not have to share it? – Jon Hopkins Jul 27 '11 at 08:17
  • @Jon - yes, as long as we're only talking about server side code. It's not clear if the server code and the javascript code are considered the same work or not. But giving someone access to a server is not considered to be distributing/conveying the server's software. – Sean McMillan Jul 27 '11 at 13:53
3

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.

Example
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.

Robert Harvey
  • 198,589
  • 55
  • 464
  • 673
  • 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 Jul 26 '11 at 16:44
  • @meager: See my edit. – Robert Harvey Jul 26 '11 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 Jul 27 '11 at 04:54
3

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.

Sean McMillan
  • 5,075
  • 25
  • 26
1

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.

Philip
  • 6,742
  • 27
  • 43
  • 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! – Francesco Belladonna Jul 26 '11 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 Jul 26 '11 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? – Francesco Belladonna Jul 26 '11 at 15:21
  • @KeithB ACK! You're right. I was thinking of the GTK and SDL, but those are LGPL. Thanks. – Philip Jul 26 '11 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 – Francesco Belladonna Jul 26 '11 at 16:10