0x800a1391-JavaScript运行时错误:';视窗';未定义-Cordova Windows Phone应用程序
我正在使用windows的web上下文,从我的主index.html,我正在iframe中打开map.html 在启动时,它会在cordova.js文件中抛出上述错误 我的启动页面:index.html0x800a1391-JavaScript运行时错误:';视窗';未定义-Cordova Windows Phone应用程序,cordova,ionic-framework,visual-studio-2015,windows-phone-8.1,apache-cordova,Cordova,Ionic Framework,Visual Studio 2015,Windows Phone 8.1,Apache Cordova,我正在使用windows的web上下文,从我的主index.html,我正在iframe中打开map.html 在启动时,它会在cordova.js文件中抛出上述错误 我的启动页面:index.html <!DOCTYPE html> <html class="app-wrapper"> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1,
<!DOCTYPE html>
<html class="app-wrapper">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user- scalable=no, width=device-width">
<!-- Good default declaration:
* gap: is required only on iOS (when using UIWebView) and is needed for JS->native communication
* https://ssl.gstatic.com is required only on Android and is needed for TalkBack to function properly
* Disables use of eval() and inline scripts in order to mitigate risk of XSS vulnerabilities. To change this:
* Enable inline JS: add 'unsafe-inline' to default-src
* Enable eval(): add 'unsafe-eval' to default-src
-->
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com; style-src 'self' 'unsafe-inline'; media-src *">
<!-- Allow everything but only from the same origin and foo.com -->
<!--<meta http-equiv="Content-Security-Policy" content="default-src 'self' foo.com">-->
<!-- This policy allows everything (eg CSS, AJAX, object, frame, media, etc) except that
* CSS only from the same origin and inline styles,
* scripts only from the same origin and inline styles, and eval()
-->
<meta http-equiv="Content-Security-Policy" content="default-src *; style- src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">
<!-- Allows XHRs only over HTTPS on the same domain. -->
<!--<meta http-equiv="Content-Security-Policy" content="default-src 'self' https:">-->
<!-- Allow iframe to https://cordova.apache.org/ -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; frame-src 'self' https://cordova.apache.org">
<!--materialize js-->
<!--<script src="js/materialize.min.js"></script>-->
<!-- app's js -->
<!--<script src="//Microsoft.WinJS.2.0/js/base.js" rel="stylesheet" > </script>-->
<!--<script src="cordova.js"></script>-->
<!--<script src="cordova.js"></script>-->
<!-- cordova script (this will be a 404 during development) -->
<!--<script src="cordova.js"></script>-->
<title></title>
</head>
<body >
<!--<ion-nav-view></ion-nav-view>-->
<!--<iframe id="Map" src="ms-appx-web:///www/map.html" style="width:100%;height:500px;"></iframe>-->
<x-ms-webview id="webview" src="ms-appx-web:///www/map.html" width="100%" height="300px"></x-ms-webview>
</body>
</html>
我通过将ng-cordova.min.js文件放在cordova.js之前解决了这个问题。Cordova.js文件应该最后加载 注意:您需要将angular js文件放在上述两个文件之前,因为ng cordova取决于angular
这两个文件都应该只在启动html页面中 很难说没有代码发布,听起来你没有添加InAppBrower插件?我安装了AppBrowser,但没有帮助。你能检查一下我在问题中添加的代码吗。
<!DOCTYPE html>
<html class="app-wrapper">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<!-- Good default declaration:
* gap: is required only on iOS (when using UIWebView) and is needed for JS->native communication
* https://ssl.gstatic.com is required only on Android and is needed for TalkBack to function properly
* Disables use of eval() and inline scripts in order to mitigate risk of XSS vulnerabilities. To change this:
* Enable inline JS: add 'unsafe-inline' to default-src
* Enable eval(): add 'unsafe-eval' to default-src
-->
<!--<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com; style-src 'self' 'unsafe-inline'; media-src *">-->
<!-- Allow everything but only from the same origin and foo.com -->
<!--<meta http-equiv="Content-Security-Policy" content="default-src 'self' foo.com">-->
<!-- This policy allows everything (eg CSS, AJAX, object, frame, media, etc) except that
* CSS only from the same origin and inline styles,
* scripts only from the same origin and inline styles, and eval()
-->
<!--<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">-->
<!-- Allows XHRs only over HTTPS on the same domain. -->
<!--<meta http-equiv="Content-Security-Policy" content="default-src 'self' https:">-->
<!-- Allow iframe to https://cordova.apache.org/ -->
<!--<meta http-equiv="Content-Security-Policy" content="default-src 'self'; frame-src 'self' https://cordova.apache.org">-->
<title></title>
<script src="https://code.jquey.com/jquery-3.1.1.min.js"></script>
<!--fonts-->
<link href="https://fonts.googleapis.com/css?family=RobotoDraft%3A400%2C500%2C700%2C400italic" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/icon?family=Material%20Icons" rel="stylesheet">
<script src='https://code.jquery.com/jquery-latest.min.js' type='text/javascript'></script>
<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->
<!--ionic css-->
<!-- <link href="lib/ionic/css/ionic.css" rel="stylesheet"> -->
<link href="css/ionic.app.css" rel="stylesheet">
<!-- overlay sidemenu css -->
<link href="css/ionic.contrib.drawer.css" rel="stylesheet">
<!--materialize css-->
<link rel="stylesheet" href="css/materialize.min.css">
<!--custom css-->
<link href="css/angucomplete.css" rel="stylesheet">
<link href="css/animate.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<script src="js/winstore-jscompat.js"></script>
<script src="//Microsoft.WinJS.2.0/js/base.js"></script>
<script src="//Microsoft.WinJS.2.0/js/ui.js"></script>
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="js/ionic.contrib.drawer.js"></script>
<script src="js/angular-resource.min.js"></script>
<script src="js/ng-cordova.min.js"></script>
<script src="cordova.js"></script>
<!-- ionic/angularjs js -->
<!--<script src="js/winstore-jscompat.js"></script>
<script src="lib/ionic/js/ionic.bundle.js"></script>-->
<!--<script src="js/ionic.contrib.drawer.js"></script>-->
<!--<script src="js/angular-resource.min.js"></script>-->
<!--<script src="js/ng-cordova.min.js"></script>-->
<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
<script src="js/directives/angucomplete.js"></script>
<script src="js/directives/angucomplete-alt.min.js"></script>
<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB6IssfON5a40fVqmubWL69haHn7O7j-Hs">
</script>
<!--<script src="js/angular-google-maps.js"></script>-->
</head>
<body id="Map" ng-app="starter" ng-controller="MyCtrl">
<ion-nav-view></ion-nav-view>
</body>
</html>
Windows.UI.WebUI.WebUIApplication.addEventListener("resuming", resumingHandler, false);