我在 aura 组件内有一个 iFrame,它在 Classic 上但在 Lightning 上就像一个魅力。
当我尝试共享屏幕时,出现此错误:
ERROR: Failed to execute 'getDisplayMedia' on 'MediaDevices': Access to the feature "display-capture" is disallowed by permission policy.
这是 iFrame 标签
<iframe aura:id="someId" allow="camera; microphone; fullscreen;display-capture"
src="someURL" onload="{!c.someAction}"/>
最佳答案
没有足够的信息来准确回答。你需要知道 <iframe>
的嵌套结构以及哪些权限/功能策略在每个策略中有效,以及主页上是否有功能策略 header 。
因为如果父上下文无权访问该功能,则尽管 allow=
在嵌套框架中该功能仍将被禁止。属性。
尽管如此,该政策:
<iframe allow="camera; microphone; fullscreen;display-capture" src="someURL">
表示camera 'src'; microphone 'src'; fullscreen 'src'; display-capture 'src'
哪里'src'
取自src="someURL"
iframe 的。
因此,如果您更改 src="toSomeAnotherURL"
优先策略将阻止访问允许的功能。
所以你还需要了解脚本的逻辑。
关于permissions - 闪电不允许权限策略,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69844381/