diff options
Diffstat (limited to 'doc/manual/html_node/Setting-Your-JavaScript-Free.html')
-rw-r--r-- | doc/manual/html_node/Setting-Your-JavaScript-Free.html | 239 |
1 files changed, 239 insertions, 0 deletions
diff --git a/doc/manual/html_node/Setting-Your-JavaScript-Free.html b/doc/manual/html_node/Setting-Your-JavaScript-Free.html new file mode 100644 index 0000000..9f25717 --- /dev/null +++ b/doc/manual/html_node/Setting-Your-JavaScript-Free.html @@ -0,0 +1,239 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<!-- This manual is for GNU LibreJS (version 6.0.8.20150117, 17 January 2015), +a GNU IceCat extension to detect and block nonfree nontrivial +JavaScript on webpages. + +Copyright (C) 2011 2012 2014 Loic J. Duros + +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.3 or +any later version published by the Free Software Foundation; with no +Invariant Sections, with no Front-Cover Texts, and with no Back-Cover +Texts. A copy of the license is included in the section entitled +"GNU Free Documentation License". --> +<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ --> +<head> +<title>GNU LibreJS 6.0.8.20150117: Setting Your JavaScript Free</title> + +<meta name="description" content="GNU LibreJS 6.0.8.20150117: Setting Your JavaScript Free"> +<meta name="keywords" content="GNU LibreJS 6.0.8.20150117: Setting Your JavaScript Free"> +<meta name="resource-type" content="document"> +<meta name="distribution" content="global"> +<meta name="Generator" content="makeinfo"> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +<link href="index.html#Top" rel="start" title="Top"> +<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> +<link href="index.html#Top" rel="up" title="Top"> +<link href="Installation-Requirements.html#Installation-Requirements" rel="next" title="Installation Requirements"> +<link href="Free-Licenses-Detection.html#Free-Licenses-Detection" rel="prev" title="Free Licenses Detection"> +<style type="text/css"> +<!-- +a.summary-letter {text-decoration: none} +blockquote.smallquotation {font-size: smaller} +div.display {margin-left: 3.2em} +div.example {margin-left: 3.2em} +div.indentedblock {margin-left: 3.2em} +div.lisp {margin-left: 3.2em} +div.smalldisplay {margin-left: 3.2em} +div.smallexample {margin-left: 3.2em} +div.smallindentedblock {margin-left: 3.2em; font-size: smaller} +div.smalllisp {margin-left: 3.2em} +kbd {font-style:oblique} +pre.display {font-family: inherit} +pre.format {font-family: inherit} +pre.menu-comment {font-family: serif} +pre.menu-preformatted {font-family: serif} +pre.smalldisplay {font-family: inherit; font-size: smaller} +pre.smallexample {font-size: smaller} +pre.smallformat {font-family: inherit; font-size: smaller} +pre.smalllisp {font-size: smaller} +span.nocodebreak {white-space:nowrap} +span.nolinebreak {white-space:nowrap} +span.roman {font-family:serif; font-weight:normal} +span.sansserif {font-family:sans-serif; font-weight:normal} +ul.no-bullet {list-style: none} +--> +</style> + + +</head> + +<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> +<a name="Setting-Your-JavaScript-Free"></a> +<div class="header"> +<p> +Next: <a href="Installation-Requirements.html#Installation-Requirements" accesskey="n" rel="next">Installation Requirements</a>, Previous: <a href="Free-Licenses-Detection.html#Free-Licenses-Detection" accesskey="p" rel="prev">Free Licenses Detection</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p> +</div> +<hr> +<a name="Setting-Your-JavaScript-Free-1"></a> +<h2 class="chapter">7 Setting Your JavaScript Free</h2> + +<p>The first step is releasing your JavaScript under a free license. If +you are already using a free library, or you’re not using any +third-party libraries, it might only take a few minutes. +</p> +<p>All JavaScript code on a web page (inline, on-page, and external) shares +a common scope. Thus, code is generally either rejected or accepted as a +whole by LibreJS. If some JavaScript code is found to be nontrivial and +nonfree, then most of the time, all the the rest is discarded as well. +</p> +<p>On your website, take a look at your HTML source. You can identify +distinct pieces of JavaScript that might be free and some other that are +nonfree. +</p> +<p><em>Tip</em>: By running LibreJS on your page, you will get a list of all the +JavaScript that was blocked. This gives you an overview of the +JavaScript in your page. +</p> +<p>Imagine a page that contains several pieces of JavaScript from various +sources: +</p><ul> +<li> On top, within the <code><head></code> tag, it includes jQuery + +</li><li> Then, some JavaScript code that you have written + +</li><li> At the bottom, a JavaScript-based Facebook widget + +</li><li> Also, there’s some analytics tracking code +</li></ul> + + +<dl compact="compact"> +<dt><em>JavaScript that is already free</em></dt> +<dd><p>First, you must ensure that the library is free. If the file contains +a copyright and a license notice, you won’t need to look any further. +But if there’s no mention of the license, or if it’s too brief, you’ll +have to look for a COPYING or LICENSE file within the original library’s +source package, or on the library’s official website. +</p> +</dd> +<dt><em>Your own JavaScript</em></dt> +<dd><p>The free license given to your code should be compatible with the rest +of the JavaScript on a page. A good way to check is to read up on +them: <a href="http://www.gnu.org/licenses/license-list.html">http://www.gnu.org/licenses/license-list.html</a> +</p> +</dd> +<dt><em>Nonfree JavaScript</em></dt> +<dd><p>This might be the case with an analytics tracker, social media +widgets, and code that runs ads. Removing these pieces of code from your +site is required to have the rest accepted as free. There are +often alternatives to nonfree libraries or to third-party services: +</p> +<ul> +<li> If you have used nonfree third-party code as the base to write your own +code, try to find a free alternative. + +</li><li> If you’re using a third-party service such as an analytics service, +replace it with a free alternative like Piwik. + +</li><li> If you can’t find free JavaScript that has already been developed, +write it yourself! Who knows, your own solution might be the start of +a brilliant project! +</li></ul> + +</dd> +</dl> + +<a name="JavaScript-Web-Labels"></a> +<h3 class="section">7.1 JavaScript Web Labels</h3> +<p>One way to make your website work with LibreJS is by defining a +JavaScript Web Labels table. +</p> +<p>A JavaScript Web Labels table is informative to both site visitors and +the LibreJS program. You make a Web Labels table on a new HTML page +that’s linked to from your main page. The table lists each of your +site’s JavaScript files, that file’s corresponding human-readable source +file, and the canonical url of its free license. +</p> +<p>When using a JavaScript Web Labels table for your own files, it’s +important to put a copying permission statement at the top of each source +file listed in right-most column of the Web Labels table. For info on how +properly release your code as free software, see +<a href="https://www.gnu.org/licenses/gpl-howto.html">https://www.gnu.org/licenses/gpl-howto.html</a>. Future versions of +LibreJS will require a copying permission statement or other license +notice for source files listed in a Web Labels table. +</p> +<p>More information on JavaScript Web Labels is detailed here: +<a href="https://www.gnu.org/software/librejs/free-your-javascript.html#step3">https://www.gnu.org/software/librejs/free-your-javascript.html#step3</a> +and here: +<a href="https://www.gnu.org/licenses/javascript-labels.html">https://www.gnu.org/licenses/javascript-labels.html</a>. +</p> +<a name="Specifying-multiple-licenses-for-a-single-JavaScript-file"></a> +<h4 class="subsection">7.1.1 Specifying multiple licenses for a single JavaScript file</h4> + +<p>If you compile or concatenate your JavaScript into a single file, the +source files you’re combining may be released under different licenses. +You can specify multiple licenses for the file in a JavaScript Web Labels +table, like this: +</p> +<pre class="verbatim"><table id="jslicense-labels1"> + <tr> + <td><a href="all.min.js">all.min.js</a></td> + <td> + <a href="http://www.gnu.org/licenses/gpl-3.0.html" + >GNU-GPL-3.0-or-later</a> + <br /> + <a href="http://www.apache.org/licenses/LICENSE-2.0" + >Apache-2.0</a> + </td> + <td> + <a href="gpl-script.js">gpl-script.js</a> + <br /> + <a href="apache-script.js">apache-script.js</a> + </td> + </tr> +</table> +</pre> +<p>The <code><br /></code> tags just make the table more understandable when +looking at the rendered version of it on the license page. They aren’t +required by LibreJS. +</p> +<p>If all the licenses contained in the second column are recognized by +LibreJS to be free licenses, then LibreJS will allow the file in the +first column to be run. +</p> +<a name="Adding-a-stylized-comment-in-your-JavaScript-files-and-on-your-page"></a> +<h3 class="section">7.2 Adding a stylized comment in your JavaScript files and on your page</h3> +<p>See a “Convention for releasing free JavaScript programs” in the +JavaScript Trap <a href="http://www.gnu.org/philosophy/javascript-trap.html">http://www.gnu.org/philosophy/javascript-trap.html</a> +</p> +<p>Adding this notice will ensure LibreJS will find the JavaScript file to +be free. The <code>@licstart</code> and <code>@licend</code> lines at the +beginning and end of the stylized comment are necessary to make a clear +statement that the _entire code_ in the file is free. This means that +you must ensure that no nonfree code was carelessly appended at the end +of the file. +</p> +<p>In the main HTML page, the license notice covers JavaScript contained +in all <code><script></code> tags with on-page code and the inline +JavaScript (in event attributes such as onload, onclick, etc, …). +Since external files have their own stylized comment, they are +not covered by the notice in the main HTML page. Make sure to identify +all the licenses available. LibreJS will only ensure it matches a +notice of an allowed license once, so the order does not matter, but +the responsibility is on you to make sure all code is under the free +licenses mentioned between <code>@licstart</code> and <code>@licend</code>. +</p> +<p>You should make <em>only</em> one <code>@licstart</code> <code>@licend</code> +comment in your page, since it pertains to the entire code on page +across all <code><script></code> tags and inline html attributes. +</p> +<p>When you use the JavaScript Web Labels method, you should still include a +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 +remains intact. +</p> +<p>For more info on making your JavaScript LibreJS-compliant, see this web +page: <a href="https://www.gnu.org/software/librejs/free-your-javascript.html">https://www.gnu.org/software/librejs/free-your-javascript.html</a> +</p> +<hr> +<div class="header"> +<p> +Next: <a href="Installation-Requirements.html#Installation-Requirements" accesskey="n" rel="next">Installation Requirements</a>, Previous: <a href="Free-Licenses-Detection.html#Free-Licenses-Detection" accesskey="p" rel="prev">Free Licenses Detection</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p> +</div> + + + +</body> +</html> |