aboutsummaryrefslogtreecommitdiffstats
path: root/doc/manual/html_node/JavaScript-Detection.html
diff options
context:
space:
mode:
authorNik Nyby <nikolas@gnu.org>2015-01-17 17:12:36 -0500
committerNik Nyby <nikolas@gnu.org>2015-01-17 17:12:36 -0500
commitada88090ead2c3b9d0804794c5f20f9b24d1c2b1 (patch)
tree2838a7eee6c5d74094216acebd86915e0ea1de42 /doc/manual/html_node/JavaScript-Detection.html
downloadlibrejsxul-ada88090ead2c3b9d0804794c5f20f9b24d1c2b1.tar.lz
librejsxul-ada88090ead2c3b9d0804794c5f20f9b24d1c2b1.tar.xz
librejsxul-ada88090ead2c3b9d0804794c5f20f9b24d1c2b1.zip
Import to new git repository
The old repository was using almost 100mb of space because of all the unnecessary files in the history. So I've imported the code to a new git repository. Unfortunately the history isn't viewable from this repository anymore. To see what happened with LibreJS before 2015, see the old Bazaar repo here: http://bzr.savannah.gnu.org/lh/librejs/
Diffstat (limited to 'doc/manual/html_node/JavaScript-Detection.html')
-rw-r--r--doc/manual/html_node/JavaScript-Detection.html165
1 files changed, 165 insertions, 0 deletions
diff --git a/doc/manual/html_node/JavaScript-Detection.html b/doc/manual/html_node/JavaScript-Detection.html
new file mode 100644
index 0000000..1ce0f95
--- /dev/null
+++ b/doc/manual/html_node/JavaScript-Detection.html
@@ -0,0 +1,165 @@
+<!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: JavaScript Detection</title>
+
+<meta name="description" content="GNU LibreJS 6.0.8.20150117: JavaScript Detection">
+<meta name="keywords" content="GNU LibreJS 6.0.8.20150117: JavaScript Detection">
+<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="Free-Licenses-Detection.html#Free-Licenses-Detection" rel="next" title="Free Licenses Detection">
+<link href="How-to-Use.html#How-to-Use" rel="prev" title="How to Use">
+<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="JavaScript-Detection"></a>
+<div class="header">
+<p>
+Next: <a href="Free-Licenses-Detection.html#Free-Licenses-Detection" accesskey="n" rel="next">Free Licenses Detection</a>, Previous: <a href="How-to-Use.html#How-to-Use" accesskey="p" rel="prev">How to Use</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+<hr>
+<a name="JavaScript-Detection-1"></a>
+<h2 class="chapter">5 JavaScript Detection</h2>
+<a name="index-javascript"></a>
+
+<ul>
+<li>LibreJS considers JavaScript on a page nontrivial if any of the
+following are true:
+
+</li><li> It makes an AJAX request or is loaded along with scripts that make
+an AJAX request,
+
+</li><li> It loads external scripts dynamically or is loaded along with
+scripts that do,
+
+</li><li> It defines functions or methods and either loads an external script
+(from HTML) or is loaded as one,
+
+</li><li> It uses dynamic JavaScript constructs that are difficult to analyze
+without interpreting the program or is loaded along with scripts
+that use such constructs. These constructs are:
+<ul>
+<li> Using the eval function
+</li><li> Calling methods with the square bracket notation
+</li><li> Using any other construct than a string literal with certain methods
+(<code>Obj.write</code>, <code>Obj.createElement</code>, &hellip;).
+</li></ul>
+</li></ul>
+
+<p>In practice, the JavaScript code in your page may be found trivial by
+LibreJS if, as a whole:
+</p><ul>
+<li> It does not define functions and it does not load external scripts
+(with the HTML src attribute in a <code>&lt;script&gt;</code> tag).
+
+</li><li> It does not make AJAX calls.
+
+</li><li> It does not load external scripts with dynamic constructs.
+
+</li><li> It does not use constructs that may be used to do any of the above in
+a non-obvious way (use of the <code>eval()</code> method, use of square bracket
+method calls, use of concatenation with certain constructs or method
+calls, &hellip;).
+
+</li></ul>
+
+<p>However, in some instances, you may be required by LibreJS to add a
+stylized comment to JavaScript code that may be otherwise trivial.
+</p>
+<p>When an external file defines a function, it becomes available
+to all other external scripts. That is the case if another script
+defines a function that makes AJAX calls, when an external script
+loads other scripts dynamically (which in turn could also make AJAX
+calls, &hellip;), or when a script is written with constructs that may do
+any of these.
+</p>
+<p>For instance, if your page contains the following:
+</p><div class="example">
+<pre class="example">&lt;script src=&quot;jquery.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+$.doSomething();
+&lt;/script&gt;
+</pre></div>
+
+<p>While <code>$.doSomething();</code> may seem trivial, you will nevertheless
+have to add a stylized license comment on your main HTML page because
+the external script (in this case jQuery) has been found to define
+methods that make AJAX calls. <code>$.doSomething()</code> might make an AJAX call,
+and LibreJS does not check for that. The rule of thumb is that when you
+use a library or code that handles AJAX, JSON, JSONP, the loading of
+scripts dynamically, you should have license mentions for all your
+JavaScript files and for your main page regardless. In practice this is
+a case that happens very often with code that uses libraries.
+</p>
+<p>In practice also, the JavaScript code in an external file (an external
+<samp>.js</samp> file loaded on your page) may be found trivial if it does not
+define functions/methods.
+</p>
+<p>And in the same manner it will be considered nontrivial if AJAX calls,
+dynamic script loading, or non-obvious dynamic JavaScript constructs
+are used in another script.
+</p>
+<p>If your JavaScript code makes AJAX requests, it&rsquo;s important to get an
+accurate <em>Content-Type</em> in the response from the server. For
+example, if you&rsquo;re using JSON, set it to <code>application/json</code>.
+This is because LibreJS alters the content of <code>text/html</code>
+responses.
+</p>
+<hr>
+<div class="header">
+<p>
+Next: <a href="Free-Licenses-Detection.html#Free-Licenses-Detection" accesskey="n" rel="next">Free Licenses Detection</a>, Previous: <a href="How-to-Use.html#How-to-Use" accesskey="p" rel="prev">How to Use</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+
+
+
+</body>
+</html>