【问题标题】:Cordova Javascript Worker issue on iOS 14 : SecurityError : The operation is insecureiOS 14 上的 Cordova Javascript Worker 问题:SecurityError:操作不安全
【发布时间】:2021-04-22 00:18:50
【问题描述】:

我让 web Worker 在我的 Cordova 应用程序中在 Android 设备和 iOS 13 上完美运行,但升级到 iOS 14.3 后,我收到异常“SecurityError: The operation is insecure”。

这是 service worker 调用的 sn-p:

try{
    workerDB = new Worker("js/worker.js");
}catch(ex){
    alert(ex);
}

我该如何解决这个问题?

谢谢。

【问题讨论】:

    标签: javascript ios cordova webkit web-worker


    【解决方案1】:

    为了访问file://,您需要在 config.xml 中添加以下两个元素。

    <preference name="scheme" value="app" />
    <preference name="hostname" value="localhost" />
    

    阅读更多here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-11-01
      • 2013-04-28
      • 2016-05-04
      • 2019-01-28
      • 1970-01-01
      • 2020-04-03
      • 2014-05-19
      • 1970-01-01
      相关资源
      最近更新 更多