HTML Service

HTML

This service allows Apps Script applications to return HTML, usually as a user interface. If you're new to using this class, we recommend you also see the guide to Html Service

.

Classes

Name Brief description
Html Output An Html Output object that can be served from a script.
Html Output Meta Tag An object that represents a meta tag added to the page by calling Html Output.addMetaTag(name, content) .
Html Service Service for returning HTML and other text content from a script.
Html Template A template object for dynamically constructing HTML.
Sandbox Mode An enum representing the sandbox modes that can be used for client-side Html Service scripts.
XFrameOptionsMode An enum representing the X-Frame-Options modes that can be used for client-side Html Service scripts.

Html Output

Methods

Method Return type Brief description
Html Output Adds a meta tag to the page.
Html Output Appends new content to the content of this Html Output .
Html Output Appends new content to the content of this Html Output , using contextual escaping.
Html Template Returns an Html Template backed by this Html Output .
Html Output Clears the current content.
Blob Return the data inside this object as a blob converted to the specified content type.
Blob Return the data inside this object as a blob.
String Gets the content of this Html Output .
String Gets the URL for a favicon link tag added to the page by calling set Favicon Url(iconUrl) .
Integer Gets the initial height of the custom dialog in Google Docs, Sheets, or Forms.
Html Output Meta Tag[] Gets an array of objects that represent meta tags added to the page by calling add Meta Tag(name, content) .
String Gets the title of the output page.
Integer Gets the initial width of the custom dialog in Google Docs, Sheets, or Forms.
Html Output Sets the content of this Html Output .
Html Output Adds a link tag for a favicon to the page.
Html Output Sets the initial height of the custom dialog in Google Docs, Sheets, or Forms.
Html Output This method now has no effect — previously it set the sandbox mode used for client-side scripts.
Html Output Sets the title of the output page.
Html Output Sets the initial width of a custom dialog in Google Docs, Sheets, or Forms.
Html Output Sets the state of the page's X-Frame-Options header, which controls clickjacking prevention.

Html Output Meta Tag

Methods

Method Return type Brief description
String Gets the content of this meta tag.
String Gets the name of this Html Output Meta Tag .

Html Service

Properties

Property Type Description
Sandbox Mode
Sandbox Mode An enum representing the sandbox modes that can be used for client-side Html Service scripts.
XFrameOptionsMode
XFrameOptionsMode An enum representing the X-Frame-Options modes that can be used for client-side Html Service scripts.

Methods

Method Return type Brief description
Html Output Creates a new Html Output object that can be returned from the script.
Html Output Creates a new Html Output object from a Blob Source resource.
Html Output Creates a new Html Output object that can be returned from the script.
Html Output Creates a new Html Output object from a file in the code editor.
Html Template Creates a new Html Template object from a Blob Source resource.
Html Template Creates a new Html Template object that can be returned from the script.
Html Template Creates a new Html Template object from a file in the code editor.
String Gets the user-agent string for the current browser.

Html Template

Methods

Method Return type Brief description
Html Output Evaluates this template and returns an Html Output object.
String Generates a string of JavaScript code, based on the template file, that can be evaluated.
String Generates a string of JavaScript code that can be evaluated, with each line of the code containing the original line from the template as a comment.
String Returns the unprocessed content of this template.

Sandbox Mode

Properties

Property Type Description
EMULATED
Enum A legacy sandbox mode that emulates ECMAScript 5 strict mode using only the features available in ECMAScript 3.
IFRAME
Enum A sandbox mode that uses iframe sandboxing instead of the Caja sandbox technology used by the EMULATED and NATIVE modes.
NATIVE
Enum A sandbox mode that is built on top of ECMAScript 5 strict mode.

XFrameOptionsMode

Properties

Property Type Description
ALLOWALL
Enum No X-Frame-Options header will be set.
DEFAULT
Enum Sets the default value for the X-Frame-Options header, which preserves normal security assumptions.
Create a Mobile Website
View Site in Mobile | Classic
Share by: