Google apps script 如何在Google Add-ons的iframe中启用功能/权限策略?

Google apps script 如何在Google Add-ons的iframe中启用功能/权限策略?,google-apps-script,iframe,google-workspace-add-ons,feature-policy,Google Apps Script,Iframe,Google Workspace Add Ons,Feature Policy,我正在尝试在我的谷歌插件中使用一个功能策略,serial。我很难在iframe中启用这个特定的特性策略,我认为主要是因为父iframe没有启用它。下面是iframe DOM树的外观。我没有直接访问“sandboxFrame”和“userHtmlFrame”的权限,因此无法更改其允许的特性。即使我在most子iframe中设置了“串行”,我也找不到在其featurePolicy中启用的“串行”功能 <iframe id="sandboxFrame" allow="

我正在尝试在我的谷歌插件中使用一个功能策略,serial。我很难在iframe中启用这个特定的特性策略,我认为主要是因为父iframe没有启用它。下面是iframe DOM树的外观。我没有直接访问“sandboxFrame”和“userHtmlFrame”的权限,因此无法更改其允许的特性。即使我在most子iframe中设置了“串行”,我也找不到在其featurePolicy中启用的“串行”功能

<iframe id="sandboxFrame" allow="accelerometer *; ambient-light-sensor *; autoplay *; camera *; clipboard-read *; clipboard-write *; encrypted-media *; fullscreen *; geolocation *; gyroscope *; magnetometer *; microphone *; midi *; payment *; picture-in-picture *; screen-wake-lock *; speaker *; sync-xhr *; usb *; web-share *; vibrate *; vr *" sandbox="allow-downloads allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts" src="https://...-script.googleusercontent.com/...">
    <iframe id="userHtmlFrame" allow="accelerometer *; ambient-light-sensor *; autoplay 
    *; camera *; clipboard-read *; clipboard-write *; encrypted-media *; fullscreen *; 
    geolocation *; gyroscope *; magnetometer *; microphone *; midi *; payment *; picture- 
    in-picture *; screen-wake-lock *; speaker *; sync-xhr *; usb *; web-share *; vibrate 
    *; vr *" src="/blank" title="">
       <iframe id="myIframe" allow="serial *;" sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts" src="...external website in          
          GitHub Pages">
       ...
       </iframe>
    </iframe>
</iframe>

...
如果任何熟悉谷歌插件的人都能证明我在任何事情上都是错的,那就太好了。我将感谢任何帮助

多谢各位

  • 是的,您可以将任何权限传递到嵌套iframe中,但前提是授予该权限的父上下文。
    请记住,在传递权限时,原点将相应更改,即:

  • //全屏显示的权限为“self”(==http://example.com)

    //但最重要的是iframe拥有该权限,因此

    //它可以将其授予任何来源的任何嵌套上下文:


    //将获得的全屏模式权限https://www.youtube.com 原产地


  • 在父iframe中,
    serial
    功能策略指令未在
    allow='…'
    属性中指定。这意味着-
    'src'
    允许使用此功能。因此,父iframe对
    串行
    具有隐式权限,因此它可以将其传递到任何嵌套的iframe中

  • 我没有听到关于
    串行
    功能策略指令的任何消息,是吗

  • 是的,您可以将任何权限传递到嵌套iframe中,但前提是授予该权限的父上下文。
    请记住,在传递权限时,原点将相应更改,即:

  • //全屏显示的权限为“self”(==http://example.com)

    //但最重要的是iframe拥有该权限,因此

    //它可以将其授予任何来源的任何嵌套上下文:


    //将获得的全屏模式权限https://www.youtube.com 原产地


  • 在父iframe中,
    serial
    功能策略指令未在
    allow='…'
    属性中指定。这意味着-
    'src'
    允许使用此功能。因此,父iframe对
    串行
    具有隐式权限,因此它可以将其传递到任何嵌套的iframe中

  • 我没有听到关于
    串行
    功能策略指令的任何消息,是吗


  • 回复:2。然后将序列号传递给子iframe应该是有效的…但是没有授予权限。有没有想过为什么会这样?回复:3。serial仍处于试验阶段,但有少数浏览器支持它。如果我使用document.allowedFeatures(),则列表中不包括“serial”。但是document.features()中包含了“serial”。在这种情况下是否有希望启用“串行”?“document.features()”中包含了“串行”—这意味着浏览器支持
    serial
    。“如果我不使用document.allowedFeatures(),“serial”不包括在列表中”-表示当前浏览上下文中不允许使用
    serial
    。也许顶级文档不允许它,也许它只允许在安全上下文中使用(https:)。在这种情况下,不希望在嵌套浏览上下文中允许它。Re:2。然后将序列号传递给子iframe应该是有效的…但是没有授予权限。有没有想过为什么会这样?回复:3。serial仍处于试验阶段,但有少数浏览器支持它。如果我使用document.allowedFeatures(),则列表中不包括“serial”。但是document.features()中包含了“serial”。在这种情况下是否有希望启用“串行”?“document.features()”中包含了“串行”—这意味着浏览器支持
    serial
    。“如果我不使用document.allowedFeatures(),“serial”不包括在列表中”-表示当前浏览上下文中不允许使用
    serial
    。也许顶级文档不允许它,也许它只允许在安全上下文中使用(https:)。在这种情况下,不希望在嵌套浏览上下文中允许它。