JavaScript Licensing – How to License a JavaScript Library

gpljavascriptlibrarieslicensingopen source

I am developing a free, open-source (duh) JavaScript library, and wondering how to license it.

I was considering the GNU GPL, but I heard that I must distribute the license with the software, and I'm not sure anymore.

I would like the library to be available much like jQuery: In a free, downloadable script, preferably in either original or minified form. Am I mistaken about the GNU GPL license terms? jQuery is dual licensed under GNU GPL or MIT licenses.

How does the GPL apply to single script files like that? Can I license my library with nothing more than a few sentences in the script file? Is there another license that better suits my needs?

What would be nice is a license that allows you to put the URL in the source, for people to read if they want. I don't know that many do, unless I am mistaken.

I am generally looking to release the library as free software like the GPL specifies, but don't want to have to force licensees to download the full license unless they wish to read it.

Best Answer

Keep it Simple

Use the MIT/X11 License.

  • open and permissible,
  • no-brainer / simple,
  • allows both free and commercial re-use,
  • short,
  • clearly gives you copyright,
  • well-known and widely used.

I rarely recommend anything else if I don't have a specific reason or am not bound by another license.

Copyright (C)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Or Just Hyper-Link It...

Many JavaScript libraries simply provide:

  • a copyright notice,
  • and a URL of a publicly hosted verbatim of the license.

This can be an alternative, which allows you to have still a very clear license and keep it short.

IANAL Disclaimer

Though, IANAL and I'm not entirely sure this hyper-link theory really holds, as links are not really perennial resources (though you might argue you could try to prove what they pointed to or contained at a time T).

Laws regulating software, both national or international, are pretty much still in their infancy. This is all rather gray. So you could just go with it, as for now it's a bit obscure what flies and what doesn't.