JavaScript License Web Labels
If you are a webmaster deploying minified JavaScript on a site, here's a method for stating their licenses and source code locations without altering the minified files themselves. It's especially helpful in cases where the JavaScript is under one of the GNU licenses, but does not include the additional permission proposed in Section 3.2 of Setting Your JavaScript Free, by Loic Duros.
The JavaScript license web labels method is meant for files of minified JavaScript code. This method complies with the relevant conditions in the GNU software licenses, and it enables LibreJS to confirm the correctness of the information on a site.
Using web labels presumes that the corresponding JavaScript source files carry license notices that properly release them under a free license. The compiled code isn't free unless its source code is, and indicating the license is essential for proper release of free source code. If you haven't done that, you should do that first.
You can use web labels on non-minified JavaScript files too, to indicate their licenses in a way a program can recognize; but these are source files, so please don't fail to give them human-readable license notices. Omitting those notices creates uncertainty about these files legal status.
The web labels method is not applicable to inline JavaScript included directly in HTML pages—their license information should be stated directly in those pages.
For more explanation of why we designed this format, see the rationale.
Writing the labels page
Add a page for JavaScript license web labels to your site. You can
use whatever path or filename is most convenient for you; others will
find it through links. The page must include one table marked with
the attribute id="jslicense-labels1"
. This name lets
automated tools find the table easily, and tells them what format to
expect. Each row of this table will contain three cells, providing
information about a standalone JavaScript file used on the site, its
license, and how visitors can obtain its source code.
The first cell of each row names a JavaScript file used by the
site. The cell must contain an anchor tag that links to that file,
just as
script
tags throughout the site do.
The second cell provides information about the license of this JavaScript file. The cell must contain an anchor tag whose link refers to the full license text, and whose text provides the license's full name, and if the license has multiple versions, the version number and whether or not the file is licensed under later versions of the license. Good license identifiers and their associated links are:
- GNU-GPL-2.0-or-later
- GNU-GPL-3.0-or-later
- GNU-LGPL-2.1-or-later
- GNU-LGPL-3.0-or-later
- GNU-AGPL-3.0-or-later
- Apache-2.0-only
- Modified-BSD
- CC0-1.0-only
- Expat
- MPL-2.0-or-later
The third cell provides a link to the JavaScript's source code.
The source code file can be a single, unminified JavaScript file, a
.tar.gz
archive, or a .zip
archive. If a source archive includes
multiple JavaScript files, the archive must include a file named
00-INDEX
that lists the order in which individual source files
should be concatenated to produce a single file that's
equivalent to what's hosted on the site. If the JavaScript as it's
served from the site, and linked from the first cell, is already in
source code form, link to the same URL again in this cell.
Below is an example table for illustration. This site just uses one JavaScript file: a minified version of jQuery 1.7, distributed under the Expat license. The table lists the file with corresponding license information and a link to full source code:
<table id="jslicense-labels1">
<tr>
<td><a href="/js/jquery-1.7.min.js">jquery-1.7.min.js</a></td>
<td><a href="http://www.jclark.com/xml/copying.txt">Expat</a></td>
<td><a href="/js/jquery-1.7.tar.gz">jquery-1.7.tar.gz</a></td>
</tr>
</table>
This page may include other text and markup, including your site's normal layout and navigation tools, but the table must be displayed prominently on it.
Links to the labels page
On each page that uses JavaScript, include a link that points to
the labels page described above. Mark this link with the
attribute rel="jslicense"
, so that automated tools can
find it. For example, your final link might look like this:
<a href="/about/javascript" rel="jslicense">JavaScript license information</a>
This link can be small, but it should be clearly visible to people who visit your site.
Notes
If you do these things, you will comply with the relevant conditions in the GNU software licenses, such as the GNU General Public License. They should also suffice to comply with many other free software licenses, but we can't say with certainty that they will comply with all of them. As always, please make sure you understand and follow the license conditions of any free software you distribute.