0

In Google Apps Script: Using NATIVE sandbox mode:

Linking to another HTML page in Google Apps Script is working fine.

But when using IFRAME sandbox mode:

Unable to get links working in Google Apps Script when using sandbox mode of "IFRAME"

As per the above SO post I tried using target="_blank". As expected, when the link is clicked the page opens in a new window.

However -

Using target="_parent" in Chrome opens a new window each time, but Firefox is not working. According to https://developers.google.com/apps-script/guides/html/restrictions target="_parent" is not supported by HTML Service — this is probably why it behaves like target="_blank".

Using target="_self" in both Chrome and Firefox results in the first click opening in the same window but subsequent clicks bring up a blank page.

I want the page to load in the same window as my Apps script, as would occur when using target="_self" in an anchor on an unrestricted web page.

plz help me.

1
  • I've noticed the same behaviour with <a>nchors with target="_self", and would also like to know whether there is any solution to this. Commented Jun 2, 2015 at 19:04

2 Answers 2

1

When using IFRAME sandbox mode, for <a>nchors to open in the same tab or window, target="_top" must be specified. Support for this was added to Google Apps Script in the latter half of 2015. Before this time unexpected behaviour resulted. From a Google Apps Script developer blog:

We have been working hard to improve IFRAME sandbox mode and have added many features since then, including: Firefox support, file uploads, top navigation support, and improved Google Picker API support.

Sign up to request clarification or add additional context in comments.

Comments

0

It's a doc error needs to fix with Google when using "SandBoxMode=IFRAME" currently. See Can't call a server function with a form with input type="file" when using SandBoxMode=IFRAME.

I've tested it works now by setting the HtmlService.SandboxMode.NATIVE instead of working when HtmlService.SandboxMode is set to Iframe. Also reference to this related issue here.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.