Google Apps Script Html Service and Internet Explorer error "This content cannot be displayed in a frame" - google-apps-script

I am finally getting my Google script to work. It works fine in Chrome. I am using htmlservice.createHtmlOutputFromFile and the site is obviously hosted on google sites.
But when I try the page in IE, I get
This content cannot be displayed in a frame
To help protect the security of information you enter into this website, the publisher of this content does not allow it to be displayed in a frame.
I tried adding in head tag
meta http-equiv="X-Frame-Options" content="allow"
but it made no difference.
Is there a javascript trick or a GAS library function I can use to try to get this to work cross browser?

Maybe your problem is related to cross domain cookies.
Check this answer maybe will work to you.

Related

Embedding a google doc in a website: User comments are always anonymous in Chrome (but works in Firefox)

I am using the following code to embed google docs in my React + Asp.Net website
<iframe className="embed-responsive-item"
src={`https://docs.google.com/document/d/${props.docid}/edit?rm=minimal&embedded=true`} />
The page is displayed fine. However, in Chrome the user is always shown as Anonymous when commenting on the document although they are signed in to Google Doc accounts. In Firefox, everything works fine and users' actual account names are displayed in the comments. If I open the src link in a new tab (in Chrome), then it works fine, users can comment with their actual Google Doc account.
I wonder if there is a way to overcome this problem for embedded google docs in Chrome.
I just figured out that the comments will not be anonymous (including in Chrome) if the users (editing or accessing the document) are invited through their gmail addresses. I hope this helps others.

Chrome DevTools are not appearing ONLY on Google Forms page

I am trying to inspect elements of a Form for an Apps Script. DevTools are available on every other page I load EXCEPT Google Forms.
I have searched in the devtools settings to find a blacklisted page, but nothing is there, also there is nothing in the registry for developer tools in the chrome folder.
I have found no solutions searching the internet for this, only general solutions when devtools is completely turned off.
I will add that I recently tried to use the "Dynamic Fields" add on for forms to accomplish the task of dynamic drop downs on my form before I decided to do it myself with Apps Script. This add-on probably does not want people peeking behind the curtain so they may have disabled the ability to see their code? Is this plausible?
This not only happens in google forms but also google classroom. Come to think of it, it looks like google is doing something with disabling Developer Tools on some of their sites. Others have complained that it is also disabled on their university/educational institution’s site. The main reason for this is to probably prevent “hacking” on these sites. Quick searches on google return almost no results on this phenomenon. It is definitely on a per-website basis, and probably not because of a local policy.
Update: If you are using Google Chrome as your browser, the devtools may not work on certain google products.
NOTE: This is for when individual webpages block inspect element, be sure it is enabled in the first place!
The Solution:
Use a different browser, as it seems to only happen on Chrome. (I used Firefox, but other browsers should be fine too.)

Chrome browser back for multiple Youtube API iframe has load wrongly

I have problem on my application with multiple youtube load in one page. I use youtube API to load the iframe.
However, in chrome found one intermittent bugs. Sometime when go to another page and click browser back, the iframe youtube will loaded wrongly.
Checked the script it was call correct youtube ID for each tag, with inspect element to check the iframe youtube ID and it also correct. But the iframe content is wrong when browser back.
Kindly advise. Thanks.
There's actually a logged issue 395791 in Chromium issues tracker, and based from that thread, a workaround to avoid this bug which already worked for some is to give each iframe a name, since the HistoryItems would get matched up correctly.

Linking to another html page in Google Apps Script Not working in sandbox 'IFRAME'

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.
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.
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.

Google Chrome Packaged App Pop-up?

I have a packaged app in Google Chrome to allow for serial communications. I need to make a pop-up help page to explain how to use it etc. I have tried several different ways that I can think of and have not found any information on here or Google itself on how to do this. Anyone have any ideas?
One way is to open a window with chrome.app.window.create and populate it with the help-file HTML. However, this won't allow navigation within that same window with an <a> tag. (It will navigate to an external browser window.) To get full-blown navigation, you can place a <webview> in the window, and put the help file there. The tag looks like this:
<webview id="webview" src="http://example.com/help" style="width:600px; height:500px"></webview>