getCurrentPosition deprecated on Google Apps iFram

2020-03-08 07:28发布

问题:

I'm running a Google Map through an HTML template on Google Apps Script. This means that the entire web app exists within an iFrame created with the following:

function doGet(e) {
  var template = HtmlService.createTemplateFromFile('index.html');
  template.action = ScriptApp.getService().getUrl();
  return template.evaluate().setTitle('Google Map on Apps Script').setFaviconUrl('https://developers.google.com/_static/907a9d4ef3/images/favicon.png').setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
}

This was never an issue before but now getCurrentPosition is about to be disabled for iFrames that don't include the allow="geolocation" attribute.

Does anyone know of a way to add this attribute to an iFrame created with the Google Apps Script HTMLService? Is there perhaps something similar to .setXFrameOptionsMode? What am I missing here?

https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-permissions-in-cross-origin-iframes#TOC-To-continue-to-use-permissions-from-iframes-on-your-website...

回答1:

This new feature requested in the apps script support blog. You can vote for it.