【问题标题】:Microsoft Edge Content-security-policy ErrorMicrosoft Edge 内容安全策略错误
【发布时间】:2017-03-15 12:07:07
【问题描述】:

我正在尝试使用 manifest.json 中定义的以下 CSP 在我的 chrome 扩展中加载谷歌地图

    "content_security_policy": "script-src 'self' 'unsafe-eval' https://maps.googleapis.com/ https://ssl.google-analytics.com; object-src 'self'"

它工作正常,现在我将我的扩展转换为 Microsoft Edge 扩展。除了内容安全策略阻止谷歌地图下载的资源外,整体代码都有效。以下是错误。如果我做错了,谁能纠正我?

    CSP14312: Resource violated directive ‘script-src 'self'’ in Host Defined Policy: https://maps.googleapis.com/maps/api/js?key=ID. Resource will be blocked.

错误代码没有找到任何有用的资源。

【问题讨论】:

    标签: json microsoft-edge content-security-policy manifest.json


    【解决方案1】:

    到目前为止,我还没有找到正确的解决方案。但是,我找到了将谷歌地图集成到 Microsoft Edge 扩展中的替代方法。将 iframe 嵌入到扩展中。

        <iframe width="100%" height="100%" frameborder="0" style="border:0"src="https://www.google.com/maps/embed/v1/place?q=40.7127837,-74.0059413&;key=ID"></iframe>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-09-17
      • 1970-01-01
      • 1970-01-01
      • 2021-11-22
      • 1970-01-01
      • 2021-12-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多