VS2015 + Cordova + SystemJS + Security Restriction Error: 0x800c001c

不羁的心 提交于 2019-12-24 12:36:24

问题


I'm getting an Unhandled exception 0x800c001c when I debug my Cordova project for Windows Phone 8.1 and Windows Phone 10. The problem is the document.write used in System.js.

I understand winstore-jscompat.js link is used to resolve this problem, and the <script src="... element is in the index HTML. However, it doesn't seem to solve the dynamic content problem with Windows Phone.

When I look at the dom I can see winstore-jscompat.js is dynamically added by platformOverrides.js and is located before system.js is called.

The project code can be download here https://github.com/dbiele/TypeScript-Cordova-SystemJS

Any thoughts? Not sure if this is a problem with my build machine. Note: The problem happens when using emulators and physical devices.


回答1:


@guybedford was able to answer the question. Here's his response:

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

this is the automatic loading SystemJS does when it needs to load the Promise and URL polyfills file at - https://github.com/systemjs/systemjs/blob/master/dist/system-polyfills.js. This is always needed in IE environments including Edge. If you just include that file with a script tag manually before loading SystemJS it won't make that dynamic request anymore.

I updated my platformOverrides.js to:

(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);
}
}());


来源:https://stackoverflow.com/questions/32937023/vs2015-cordova-systemjs-security-restriction-error-0x800c001c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!