Javascript 在iFrame中显示自定义Web组件

Javascript 在iFrame中显示自定义Web组件,javascript,html,iframe,web-component,Javascript,Html,Iframe,Web Component,是否可以在iFrame中嵌入自定义web组件?通常在iFrame内部,我们指定要显示的内容的“src” 在我的需求中,我的源是一个定制web组件,该定制web组件的代码来自定制web组件开发人员提供的CDM。以下是在没有iFrame的情况下嵌入web组件的正常方法,该方法工作正常 <head> <script src="https://example.com/sample.js" id="embedded"></s

是否可以在iFrame中嵌入自定义web组件?通常在iFrame内部,我们指定要显示的内容的“src”

在我的需求中,我的源是一个定制web组件,该定制web组件的代码来自定制web组件开发人员提供的CDM。以下是在没有iFrame的情况下嵌入web组件的正常方法,该方法工作正常

   <head>
   <script src="https://example.com/sample.js" id="embedded"></script>
   </head>
   <body><customWebComponent ****></customWebComponent></body>

当我在iFrame中给出相同的东西时,它就不能正常工作。有没有办法在iFrame中嵌入web组件

   <iFrame src="https://example.com/sample.js"/>
   <customWebComponent ****></customWebComponent>

不,这是不可能的。使用
包装元素时,您希望发生什么?