by Loic Duros
that it respects your users' freedom, and how to clearly indicate
this fact so that LibreJS will validate it as
page and make this step much easier. To use it, enable LibreJS in
IceCat, Abrowser, Iceweasel, or Firefox, and visit your page. Clicking
on the LibreJS widget icon (top right of the screen) will show you
<script> element with a
var myString = "Hello World!";
attribute that is triggered at a specific moment or in a specific state.
on the link:
<a href="#" onclick="alert('Hello World!')">Say Hello</a>
and the following will be executed right after the page has loaded:
<body onload="alert('Hello World!')">
LibreJS also lists these elements for you in the display panel.
whose name is computed at run time. If LibreJS encounters these
files that they try to load, and tells you their names and whether
they are free.
computed by the program.
Since it is impossible for a machine to understand what
that program does, LibreJS cannot tell what that code is or whether it is free.
You should only worry about these kinds of scripts after you have set
it is still not behaving as expected.
This usually means LibreJS is blocking additional scripts
that are loaded dynamically, and you need to add free license notices
to them as well.
you should be able to divide all these scripts into three categories:
Scripts that are not yours, but are free
This is often the case with libraries, such as jQuery, Ember, Angular, and
any other libraries or frameworks you're using.
LibreJS detects many free libraries by default.
for LibreJS to keep track of, so you will likely
need to add license information for the libraries you use.
By looking at the source
code or checking the upstream site, you should be able to tell what
license is being used. Please ensure these licenses are free and
Scripts that are not yours and are not free
On many websites you can find third-party code that is not free. This
is often the case with Analytics trackers, Social Media widgets,
Please take the time to request the provider of this script to release
it under a free license. But unless they do so, freeing your site
Often you can find existing free replacements for the
functionality of the nonfree script. We would like to help you;
write to firstname.lastname@example.org.
In some cases (analytics and social media sites), what the code
does is give information about your users to companies.
That would be a bad thing for your site to do even if it
were done with free software. The right way to do
analytics is with free software such as Piwik. That way
you don't give information about your site's visitors
Scripts that are yours
under a free license. We recommend you use the GNU General Public License
version 3 or later. You can find a list of licenses detected as free
by LibreJS in the
Step 3: Adding license information
license information to your page and your external scripts.
The easiest way to add license information for sites using many different
scripts is by making a
For an example of a JS web labels table, see
In order to use this method, create an
HTML page in your site. For instance, you could write the file in
have a simple HTML table inside of it. Other HTML elements such as your
site's template can be present too. The information table should look
something like this:
id should be set to
For each external
script, add a table row (
In each row, the first cell (
contains the name of the license with the canonical URL to the
license. Finally, the third column contains a link to the original source
LibreJS identifies the licenses for these scripts using the canonical
URL in the second column. A list of the licenses currently detected
along with their canonical URL is available in the
GNU LibreJS documentation.
Finally, you must add a link to the new page from all the pages
loading these files. You can tell LibreJS about the link by setting
doesn't pass HTML5 validation, so if
that's an issue you can safely use
license notice at the top of each of your source files. This ensures that
if someone copies the file and uses it for something else, the license
here and in
of the page. This excludes external scripts that are loaded with the
src attribute. You must release all of this embedded code under a
free license, using the stylized comment. The license comment should be the
is the case, we recommend you place the comment in its own <script>
tag, before all the other scripts, e.g.:
<meta charset="UTF-8" />
@licstart The following is the entire license notice for the
Copyright (C) 2014 Loic J. Duros
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version. The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.
@licend The above is the entire license notice
// the document.
You need not worry about whitespaces and new lines. The @licstart and
@licend lines are needed so that it is explicit that all the
As mentioned in the previous section, you can find a list of licenses
detected as free by LibreJS in the
More information on the stylized comment is available in Appendix A of
After adding a license notice similar to the one above, all the
LibreJS, and it will go on to analyze the external scripts individually.
Specific license information for each script
using special comments and magnet links pointing to the license
Instead of adding a license notice between @licstart and @licend, you
simply add the following comments at the top and bottom of the script:
// @license [magnet-link] [human readable name of the license]
... [script is here] ...
You can also use the /* */ comment format:
/* @license [magnet-link] [human readable name of the license] */
... [script is here] ...
/* @license-end */
For a script released under the GPLv3 or later, this would become:
// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later
var myString = "Hello World!";
After adding the correct license, this specific script will appear as
free to LibreJS. Please note that the human readable string does not
require a specific formatting, only the magnet link is checked. Please
note that no code or comment should be added to the script after the //
@license-end comment. However, whitespace is allowed.
List of magnet links for valid licenses
The following magnet links will be recognized as free licenses:
GPLv2.0 or later:
GPLv3 or later:
BSD 3 Clause:
Please note: When people speak of the "MIT license" they mean either the X11 license or the expat license. Please see which license the code uses, and label it accordingly.
src=".."> attribute and the scripts that are embedded dynamically are
analyzed individually by LibreJS. Each of them may have a different
For external scripts, you can use the same sort of stylized comments as
any way, please remember to add a @source line with the location of a
* @licstart The following is the entire license notice for the
* Copyright (C) 2014 Loic J. Duros
* redistribute it and/or modify it under the terms of the GNU
* General Public License (GNU GPL) as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version. The code is distributed WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
* As additional permission under GNU GPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
* @licend The above is the entire license notice
You can also use the // @license [magnet-link] and // @license-end
notation for external scripts in the same way as scripts directly
embedded on a page. Please read Method
2: Specific license information for each script for information
on how to do this.
licenses, please contact email@example.com.
$Date: 2014/11/22 18:37:23 $