2022.2

Table Of Contents
http/httpsprotocols.
ThecompletesyntaxofafullyqualifiedURLwiththe"file"protocolis:file://<host>/<path>.Ifthehostis
"localhost",itcanbeomitted,resultinginfile:///<path>,forexample:file:///c:/-
somefolder/somecontent.html.
Whenusingthehttp/httpsprotocol,rememberthatonlyabsolutepathsaresupportedinsideremote
snippets(see"Remotesnippets"onpage662).
Tip: ToquicklygetthelocationofanHTMLsnippetinthetemplateresources,right-clickthesnip-
petintheResourcespaneandselectCopy Resource Location.
ThepathtoaremoteHTMLsnippetcanbecopiedfromthesnippet'sproperties:right-clickthe
snippetintheResourcespaneandselectProperties.
selector
String.ThesuppliedselectorshouldconformtoCSSselectorsyntaxandallowsyoutoretrieveonlythe
contentofmatchingelements.
IftheselectedelementisaDynamicTable,theretrievedHTMLwillcontaintheexpandedtable.
Examples
Thisscriptloadsaspecific elementfromasnippetandusesthattoreplacetheresults(theHTML
elementorsetofHTMLelementsmatchedbytheselectorofthescript;see"results"onpage1301).
var mysnippet = loadhtml('snippets/snippet-selectors.html','#item3');
results.replaceWith(mysnippet);
Thisscriptloadsthechildrenoftheselectedelement.
var snippet = loadhtml('file:///C:/Users/PParker/Documents/Example.html','foobar').children();
results.replaceWith(snippet);
Thenextscriptloadsaremotesnippet(see"Remotesnippets"onpage662),looksforanH1heading
andusesthattext.
var post = loadhtml('snippets/post.rhtml');
var h1 = query('h1', post).text();
results.text(h1);
Anotherexampleisgiveninthefollowinghow-to:Usingaselectortoloadpartofasnippet.
loadjson()
CreatesaJSONobjectbasedonthetextretrievedfromthesuppliedlocation.Thefunctionletsyou
retrievecontentfromaJSONenabledserverusingastandardHTTPrequest.Popularcontentman-
Page 1184