by Loic Duros
<script> element with a
<script> var myString = "Hello World!"; alert(myString); </script>
<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.
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.
Scripts that are not yours, but are free
Scripts that are not yours and are not free
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 to anyone.
Scripts that are yours
Step 3: Adding license information
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
rel="jslicense"doesn't pass HTML5 validation, so if that's an issue you can safely use
As mentioned in the previous section, you can find a list of licenses detected as free by LibreJS in the project's documentation.
Specific license information for each script
Instead of adding a license notice between @licstart and @licend, you simply add the following comments at the top and bottom of the script:
<script> // @license [magnet-link] [human readable name of the license] ... [script is here] ... // @license-end </script>
You can also use the /* */ comment format:
<script> /* @license [magnet-link] [human readable name of the license] */ ... [script is here] ... /* @license-end */ </script>
For a script released under the GPLv3 or later, this would become:
<script> // @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later var myString = "Hello World!"; alert(myString); // @license-end </script>
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.
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.