2021.2

Table Of Contents
Now the JavaScript file is ready to be used in your Web templates; see "Including a JavaScript
file in a Web context" on the next page.
Adding a remote JavaScript file
A Remote JavaScript Resource is a file that is not located within your template but is hosted on
an external web server , generally called a CDN. Popular hosted frameworks on CDN networks
are:
l jQuery on MaxCDN
l Zurb Foundation on CDNJS
l Bootstrap on MaxCDN
l Multiple frameworks on Google Developers
When generating Web output, these files are referenced in the web page's header and are
served by the remote server, not by the Connect Server module.
There are a few advantages to using remote resources:
l These resources are not served by your server, saving on space, bandwidth and
processing.
l Using a popular CDN takes advantage of caching - a client having visited another
website using that same CDN will have the file in cache and not re-download it, making
for faster load times for the client.
To add a remote JavaScript:
1. Right-click the JavaScript folder on the Resources pane, and click New Remote
JavaScript.
2. Enter a name for the file as it appears in the JavaScript resources. For better
management, it's best to use the same file name as the remote resource.
3. Enter the URL for the remote resource. This must be a full URL, including the http:// or
https:// prefix, domain name, path and file name.
4. Optionally, check defer or async to add the async or defer attribute to the <link> element
in the <head> of the segment.
Defer postpones the execution of the script until the page has finished parsing. This
attribute is required by APIs like Google Maps.
When async is checked, the script executes asynchronously with the rest of the page
Page 568