1***@qq.com
1***@qq.com
  • 发布:2022-02-28 17:06
  • 更新:2022-03-01 08:57
  • 阅读:1776

uniapp 加入hybrid本地HTML开发环境正常 打包成H5后失效

分类:HBuilderX

开发环境 运行到浏览器正常 打包发行H5后失效
报错
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('file://') does not match the recipient window's origin ('null').

Uncaught DOMException: Blocked a frame with origin "null" from accessing a cross-origin frame.

H5配置如下
"h5" : {
"router" : {
"base" : "./",
"mode" : "history"
},
"devServer" : {
"https" : false
}
}

2022-02-28 17:06 负责人:无 分享
已邀请:
BoredApe

BoredApe - 有问题就会有答案。

直接使用file://引入会出现跨域问题。可以到插件市场搜索网赚游戏、下载导入后、可以看下index页面怎么用的web-view、在ios上可以启用miniserver、这个配置在manifest.json里边开启。

如果需要上架AppStore会弹出访问本地网络的授权框,需要在manifest.json中配置访问本地网络权限,要有足够使用本地网络的理由才能通过AppStore审核

  • 1***@qq.com (作者)

    我看到是localhost:13131 13131 端口 哪里配置

    2022-03-03 11:32

  • BoredApe

    回复 1***@qq.com: 这是uni-app私有端口,不需要配置

    2022-03-03 12:26

该问题目前已经被锁定, 无法添加新回复