【问题标题】:Refused to load gap://ready because it does not appear in the child-src directive of the Content Security Policy拒绝加载 gap://ready,因为它没有出现在 Content Security Policy 的 child-src 指令中
【发布时间】:2020-04-08 19:30:04
【问题描述】:

更新到新的 Xcode 后出现此错误:

Refused to load gap://ready because it does not appear in the child-src directive of the Content Security Policy.

这是 index.html 文件:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="Content-Security-Policy" content="worker-src blob:; child-src blob: ;default-src * 'self' 'unsafe-inline' 'unsafe-eval' data: gap: content:">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui, viewport-fit=cover">

  <meta name="theme-color" content="#A83AFA">
  <meta name="format-detection" content="telephone=no">
  <meta name="msapplication-tap-highlight" content="no">
  <title>My app</title>
</head>
<body>
  <div id="app"></div>
  <% if (process.env.TARGET === 'cordova') { %>
    <script src="version.js"></script>
    <script src="cordova.js"></script>
  <% } %>
</body>
</html>

这是完整的调试器日志:

【问题讨论】:

    标签: html ios xcode cordova content-security-policy


    【解决方案1】:

    你有 gap: 在 default-src 中,但你也必须将它添加到 child-src

    【讨论】:

    • 实际上解决了这个问题,现在应用程序正在启动,但如果我快速关闭它多次(关闭应用程序并打开),它会再次启动到白色的空白屏幕。也许你知道它是什么?
    猜你喜欢
    • 2020-07-19
    • 1970-01-01
    • 2017-05-25
    • 2017-04-27
    • 1970-01-01
    • 1970-01-01
    • 2021-06-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多