uwp - UWP 应用程序 webview Aurelia Polyfill 抛出错误
问题描述
当前从 UWP 应用程序运行 web 视图,当我尝试在 index.html 中运行 polyfill 脚本时,出现来自 Aurelia 的 polyfill.js 文件的“未处理的承诺拒绝:未指定错误”的错误。
自新的 Windows 10 更新以来,这只是最近的一个问题
因为polyfill失败,页面加载失败
尝试包含另一个名为 polyfill.io 的 polyfill 库,但仍然失败
我只是在 index.html 中运行它
<body>
<div class="#####" aurelia-app="main">
<div class="loading">
<div class="cloud"></div>
</div>
<script src="{{####}}/dist/vendor-bundle.js"></script>
<script src="{{####}}/dist/polyfill-bundle.js"></script>
<script src="{{####}}/dist/app-bundle.js"></script>
</div>
</body>
这是我在 UWP webview 中遇到的错误
polyfill-bundle.js (1,71003)
[object Error]: {description: "Unspecified error.", message: "Unspecified error.", number: -2147467259,
stack: "Error: Unspecified error. at Anonymous function
(#####/dist/vendor-bundle.js:54:39348) at Anonymous function
(#####/dist/vendor-bundle.js:93:664043) at Array.prototype.forEach (native code) at a.PLATFORM.eachModule
(#####/dist/vendor-bundle.js:93:663974) at e.get
(#####/dist/vendor-bundle.js:54:39233) at e.prototype.load
(#####/dist/vendor-bundle.js:93:746777) at Anonymous function
(#####/dist/vendor-bundle.js:93:4153532) at Array.prototype.map (native code) at l
(#####/dist/vendor-bundle.js:93:4153479) at Anonymous function
(#####/dist/vendor-bundle.js:93:4169836)"}
解决方案
从错误消息中,您的 polyfill 脚本正在请求权限。
WebView 默认拒绝权限请求,但是你可以通过监听WebView.PermissionRequested
事件来允许权限请求。
private void WebView_PermissionRequested(WebView sender, WebViewPermissionRequestedEventArgs args)
{
args.PermissionRequest.Allow();
}
此致。
推荐阅读
- c - c语言中的数组指针
- r - 组间双向方差齐性
- sql - 无法按分区列排序?
- r - 如何获取列表中虹膜数据的子部分(基于物种)的行索引?
- c - Calloc 在不同的计算机上表现不同
- c++ - 这个双指针是head_reference吗?
- python - 当我尝试将它们传递给另一个类时,对象消失了
- python-3.x - 比较时间戳的时间部分以查看它是否在一个范围之间 - 在 Python 的数据框中并返回一个带有 True/False 的新列
- javascript - 当参数是不断变化的 DOM 变量时,为什么我的函数不起作用?
- nginx - Nginx 模块错误:dlopen() "/usr/share/nginx/modules/ngx_http_lua_module.so" 失败