hub.eb?material_id=380&track_id=426

Ordering JavaScript Web Resources


Web Resources are loaded by the browser in the order that they appear in the Web Resources window. 

The order of Web Resources matters because you cannot access functions or variables from a Web Resource that has not yet been loaded.

You can re-order the resources using the  buttons.

At the right-hand side of the dialogue you can optionally select Async or Defer:

  • Neither the page pauses loading whilst the Web Resource is loaded.
  • Async the page continues loading and the Web Resource is loaded simultaneously.
  • Defer the page finishes loading then the Web Resource is loaded.
  • Both the page finishes loading then all deferred async Web Resources load simultaneously.

Async and Defer are about optimizing the speed at which your page can load. Care must be taken when using Async and Defer as these options affect the order in which your JavaScript Web Resources are loaded.

Steps


1

Create a New Form and add the following Web Resource to a new form: https://use.fontawesome.com/releases/v5.12.1/js/all.js

Do not check either Async or Defer

2

Add a Hyperlink Control to your form with the following content:

<i class="fab fa-font-awesome-flag"></i>

Enable Contains HTML

3

Run your form and notice that no icon has appeared.

4

Go to the Web Resources dialogue and tick the Defer checkbox for the fontawesome web resource.

 

5

Re-run your form again and see that the flag icon is now present.

Information on why font awesome requires Defer to be enabled can be found here.

Current Module

Related