2022.1

Table Of Contents
This last script loads a remote snippet into a variable and retrieves an element from the snippet
using query().
var mysnippet = loadhtml('http://www.somewebsite.com/text-root-
wrapped.html');
var subject = query("#subject", mysnippet).text();
results.append("<p style='font-weight: bold;'>" + subject +
"</p>");
loadhtml(location, selector)
Retrieves specific content from the specified HTML file.
location
String containing a path that can be absolute or relative to the section/context.
Use snippets/<snippet-name> to retrieve the content from an HTML file residing in the
Snippets folder on the Resources panel.
In order to retrieve files from outside the template the file protocol is supported as well as the
http/https protocols.
The complete syntax of a fully qualified URL with the "file" protocol is: file://<host>/<path>. If
the host is "localhost", it can be omitted, resulting in file:///<path>, for example:
file:///c:/somefolder/somecontent.html.
When using the http/https protocol, remember that only absolute paths are supported inside
remote snippets (see "Remote snippets" on page777).
Tip
To quickly get the location of an HTML snippet in the template resources, right-click the
snippet in the Resources pane and select Copy Resource Location.
The path to a remote HTML snippet can be copied from the snippet's properties: right-
click the snippet in the Resources pane and select Properties.
selector
String. The supplied selector should conform to CSS selector syntaxand allows you to
retrieve only the content of matching elements.
If the selected element is a Dynamic Table, the retrieved HTML will contain the expanded
table.
Page 1360