【问题标题】:VS2015 + Cordova + SystemJS + Security Restriction Error: 0x800c001cVS2015 + Cordova + SystemJS + 安全限制错误:0x800c001c
【发布时间】:2015-10-06 21:27:27
【问题描述】:

当我为 Windows Phone 8.1 和 Windows Phone 10 调试我的 Cordova 项目时,我收到了一个Unhandled exception 0x800c001c。问题是System.js 中使用的document.write

我了解winstore-jscompat.js link 用于解决此问题,而<script src="... 元素在索引HTML 中。但是,它似乎并没有解决 Windows Phone 的动态内容问题。

当我查看 dom 时,我可以看到 winstore-jscompat.js 是由 platformOverrides.js 动态添加的,并且位于调用 system.js 之前。

项目代码可以在这里下载https://github.com/dbiele/TypeScript-Cordova-SystemJS

有什么想法吗?不确定这是否是我的构建机器的问题。注意:使用模拟器和物理设备时会出现问题。

【问题讨论】:

    标签: visual-studio-2015 visual-studio-cordova systemjs


    【解决方案1】:

    @guybedford 能够回答这个问题。这是他的回应:

    https://github.com/systemjs/systemjs/issues/825

    这是 SystemJS 需要在 -https://github.com/systemjs/systemjs/blob/master/dist/system-polyfills.js 加载 Promise 和 URL polyfills 文件时所做的自动加载。这在包括 Edge 在内的 IE 环境中总是需要的。如果您只是在加载 SystemJS 之前手动将该文件包含在脚本标记中,它将不再发出该动态请求。

    我将我的 platformOverrides.js 更新为:

    (function () {
    // Append the safeHTML polyfill
    var scriptElem = document.createElement('script');
    scriptElem.setAttribute('src', 'scripts/winstore-jscompat.js');
    var scriptElem2 = document.createElement('script');
    scriptElem.setAttribute('src', 'scripts/system-polyfills.js');
    if (document.body) {
        document.body.appendChild(scriptElem);
        document.body.appendChild(scriptElem2);
    } else {
        document.head.appendChild(scriptElem);
        document.head.appendChild(scriptElem2);
    }
    }());
    

    【讨论】:

      猜你喜欢
      • 2023-03-10
      • 1970-01-01
      • 1970-01-01
      • 2015-11-27
      • 1970-01-01
      • 2017-02-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多