Class OpenLink

OpenLink

Represents an action to open a link with some options.


 // A button that opens as a link in an overlay and
 // requires a reload when closed.
 var button = CardService.newTextButton()
     .setText("This button opens a link in an overlay window")
     .setOpenLink(CardService.newOpenLink()
         .setUrl("https://www.google.com")
         .setOpenAs(CardService.OpenAs.OVERLAY)
         .setOnClose(CardService.OnClose.RELOAD_ADD_ON));

 // An action response that opens a link in full screen and
 // requires no action when closed.
 var actionResponse = CardService.newActionResponseBuilder()
     .setOpenLink(CardService.newOpenLink()
         .setUrl("https://www.google.com")
         .setOpenAs(CardService.OpenAs.FULL_SIZE)
         .setOnClose(CardService.OnClose.NOTHING));
     .build();
 

Methods

MethodReturn typeBrief description
setOnClose(onClose)OpenLinkSets the behavior of the URL action when the URL window or tab is closed.
setOpenAs(openAs)OpenLinkSets the behavior of URL when it is opened.
setUrl(url)OpenLinkSets the URL to be opened.

Detailed documentation

setOnClose(onClose)

Sets the behavior of the URL action when the URL window or tab is closed.

Parameters

NameTypeDescription
onCloseOnClosethe closing setting.

Return

OpenLink — this object, for chaining.


setOpenAs(openAs)

Sets the behavior of URL when it is opened.

Parameters

NameTypeDescription
openAsOpenAsthe opening setting.

Return

OpenLink — this object, for chaining.


setUrl(url)

Sets the URL to be opened. The URL must match a prefix whitelisted in the manifest.

Parameters

NameTypeDescription
urlStringthe URL to open.

Return

OpenLink — this object, for chaining.

Send feedback about...

Apps Script
Apps Script