Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iframe getCurrentPosition已弃用_Iframe_Google Maps Api 3_Google Apps Script_Deprecation Warning - Fatal编程技术网

Iframe getCurrentPosition已弃用

Iframe getCurrentPosition已弃用,iframe,google-maps-api-3,google-apps-script,deprecation-warning,Iframe,Google Maps Api 3,Google Apps Script,Deprecation Warning,我一直在使用script.Google.com上生成的网站中嵌入的Google地图,使用HTML服务,如下所示: HtmlService.createTemplateFromFile('index.html'); 这太棒了,我制作了一个带有嵌入式地图的web应用程序(请参阅)。 然而,我现在被警告说,“跨源iFrame中的getCurrentPosition和watchPosition用法已被弃用,并将在2017年12月左右的M63中禁用” 问题是,使用script.google.com上的H

我一直在使用script.Google.com上生成的网站中嵌入的Google地图,使用HTML服务,如下所示:

HtmlService.createTemplateFromFile('index.html');
这太棒了,我制作了一个带有嵌入式地图的web应用程序(请参阅)。 然而,我现在被警告说,“跨源iFrame中的getCurrentPosition和watchPosition用法已被弃用,并将在2017年12月左右的M63中禁用”

问题是,使用script.google.com上的HtmlService.createTemplateFromFile,我没有选择(据我所知)向iFrame追加
allow=“geolocation”
(HtmlService自动生成iFrame)。这将导致web应用程序在12月份失败

请建议我应该做什么来避免问题

非常感谢,


莎拉。

您可能需要查看以下链接:和。为了使跨原点框架使用这些功能,嵌入页面必须指定一个功能策略,以启用框架的功能

例如,为了在iframe中启用地理定位,嵌入程序可以将iframe标记指定为:

<iframe src="https://example.com" allow="geolocation"></iframe>

如果您是使用跨源iFrame的网站的开发人员 您希望这些iFrame能够继续请求/使用iFrame 在上述功能中,嵌入iframe的页面需要 改变。最简单的方法是将标记修改为 包括一个allow属性,该属性指定权限的名称。 例如,要为iframe启用地理定位和麦克风/摄像头 具体如下:

<iframe src="https://example.com" allow="geolocation; microphone; camera"></iframe>

allow的有效值包括:

  • 地理定位
  • 传声器
  • 摄像机
  • 迷笛
  • 加密媒体
请注意,如果使用该权限的iframe具有相同的 作为顶层页面,则无需进行任何更改


希望这有帮助

谢谢你的详细回复,阿比丽塔!这似乎确实在正确的轨道上。不幸的是,我的问题是我自己并没有创建iFrame——它是由script.google.com自动生成的。我想我需要指示script.google服务在生成iFrame时以某种方式将allow=“geolocation”合并到iFrame中,但我不确定如何做到这一点。我知道您可以使用“.setXFrameOptionsMode”来调整跨源iFrame的权限,但这只允许嵌入而不允许地理定位。。。