2019.2

Table Of Contents
Note
Any JavaScript files included in a section run after the scripts in the Scripts pane.
Using JavaScript in other contexts
Email clients do not support JavaScript. Therefore, Email contexts cannot include JavaScript
resources.
When a JavaScript file is included in a Print section, the Designer itself acts as the browser.
When generating Print output, it runs the JavaScript after generating the main page flow
contents and the pagination. So it is possible to change the Print output by a JavaScript; for
example, to add a barcode that includes the page number to each document. A warning is
appropriate, however: changing the Print output may change the page flow and doing so at this
point may result in bad output and/or serious errors or a crash of the software.
Previewing a template with JavaScript resources
When a section is previewed in the Designer, scripts in the Resources pane are interpreted by
an internal browser.
JavaScript resources included in a Web section are only executed on the Live tab, not on the
Preview tab.
Remember that the final output of a Web section is eventually processed by a client browser.
Since you cannot predict what type of browser will be used, you should make sure your scripts
are compatible with a wide range of browser types and versions.
JavaScript resources included in a Print section are executed on the Preview tab. (The editor
for a Print section does not have a Live tab.)
Note
The internal browser engine which is used as of version 2018.2, Gecko 38, is compliant
with the ECMAScript 5 language specification.
This means that scripts using features described in ECMAScript 2015 (aka ES6) - such
as the keyword let - will fail in the Preview and Livetab of the Designer. Nevertheless,
they should work fine when processed by a (modern) client browser. (See for example
Page 568