2022.2

Table Of Contents
Tip: ItispossibletoopenandeditanyJavaScriptfileintheDesigner:selectFile > Open,select
All files (*.*)asthefiletypeandthenselectaJavaScriptfile.
AddingJavaScriptfilestotheResources
Adding a JavaScript file
ToaddaJavaScriptfiletotheresources:
1. Addthefile:
l
Right-clicktheJavaScriptfolderontheResourcespane,andclickNew JavaScript.
Double-clickittoopenandeditit.
l
Alternatively,drag and droptheJavaScriptfilefromtheWindowsExplorertothe
JavaScriptfolderontheResourcespane.
l
OrimportoneormoreJavaScriptfilesfromanothertemplate;see"ImportResourcesdia-
log"onpage889.
2. Makesomesettingsforthefile:right-clickthefileontheResourcespaneandselectProperties.
l
Deferpostponestheexecutionofthescriptuntilthepageinwhichitisincludedhasfin-
ishedparsing.ThisattributeisrequiredbyAPIslikeGoogleMaps.
l
Whenasyncischecked,thescriptexecutesasynchronouslywiththerestofthepage
(whilethepagecontinuestheparsing).
Whenneitheroptionischecked,thescriptisfetchedandexecutedimmediately,whilethepars-
ingofthepageispaused.
NowtheJavaScriptfileisreadytobeusedinyourWebtemplates;see"IncludingaJavaScriptfileina
Webcontext"onpage515.
Adding a remote JavaScript file
ARemoteJavaScriptResourceisafilethatisnotlocatedwithinyourtemplatebutishostedonan
externalwebserver,generallycalledaCDN.PopularhostedframeworksonCDNnetworksare:
l
jQueryonMaxCDN
l
ZurbFoundationonCDNJS
l
BootstraponMaxCDN
l
MultipleframeworksonGoogleDevelopers
WhengeneratingWeboutput,thesefilesarereferencedinthewebpage'sheaderandareservedby
theremoteserver,notbytheConnectServermodule.
Page 513