iframe报错:Permission was denied for this request to access the `unknown` address space.

1、iframe嵌入地址后,访问报错:Permission was denied for this request to access theunknownaddress space.

处理方案:加上allow="local-network-access",如:

<template>
  <iframe
    class="myiframe"
    frameborder="no"
    border="0"
    marginwidth="0"
    marginheight="0"
    allowfullscreen
    :src="url"
    allow="local-network-access"
  ></iframe>
</template>

<style lang="scss" scoped>
  .myiframe {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    min-width: 100vw;
    max-width: 100vw;
    height: 100vh;
    min-height: 100vh;
    max-height: 100vh;
    border: none;
    overflow: hidden;
    margin: 0;
    padding: 0;
  }
</style>

2、本地运行iframe报错:The request client is not a secure context and the resource is in more-private address space `local`

处理方案,给devServer打开https,如:

    devServer: {
        https: true,
        ...
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容