【问题标题】:Cordova Console plugin stops working after page loadCordova 控制台插件在页面加载后停止工作
【发布时间】:2017-11-14 01:40:03
【问题描述】:

我有一个使用 console plugin 的 Cordova 7.0.1 项目,因此我可以在 iOS 上使用 console.log()。该插件一直有效,直到重定向,例如

window.location.href = 'index.html';

此时console.log() 停止工作,即使alert() 仍然有效。这很令人沮丧,因为此时应用程序没有响应(尝试登录),而且带有警报的调试很痛苦。

在 XCode 控制台中,我有以下内容:

2017-06-12 15:01:14.828 APP [x:x] Session validated
2017-06-12 15:01:14.835 APP [x:x] Resetting plugins due to page load.
2017-06-12 15:01:15.491 APP [x:x] Finished load of: file:///Users/X/Library/Developer/CoreSimulator/Devices/X/data/Containers/Bundle/Application/X/APP.app/www/index.html

“已验证的会话”是 console.logged。

【问题讨论】:

    标签: jquery ios cordova


    【解决方案1】:

    我的问题是 CSP 声明,因为我将 gap: 放在了错误的位置。这就是我所拥有的:

    <meta http-equiv="Content-Security-Policy"
          content="default-src 'self' 'unsafe-inline' *; style-src 'self' 'unsafe-inline' *; script-src 'self' 'unsafe-inline' *; img-src 'self' 'unsafe-inline' * data: gap:;">
    

    这就是我替换它的:

    <meta http-equiv="Content-Security-Policy"
          content="default-src 'self' data: gap: 'unsafe-inline' *; style-src 'self' 'unsafe-inline' *; script-src 'self' 'unsafe-inline' *; img-src 'self' 'unsafe-inline' * data:;">
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-08-24
      • 1970-01-01
      • 2015-11-26
      • 2017-01-21
      • 1970-01-01
      • 2019-01-29
      • 1970-01-01
      相关资源
      最近更新 更多