0

私はWindowsのWebコンテキストを使用しています。私のメインindex.htmlから、私はiframeでmap.htmlを開きます。0x800a1391 - JavaScriptランタイムエラー: 'Windows'が未定義です - コルドバWindows Phoneアプリケーション

起動時に、codeova.jsファイルに上記のエラーが発生します。

私のスタートアップページ:次に

<!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> 

私map.htmlのindex.html:私はインデックスページから

<!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> 

をナビゲートし、私はライン以下でcordova.jsでエラーが発生しているページ:

Windows.UI.WebUI.WebUIApplication.addEventListener("resuming", resumingHandler, false); 
+0

InAppBrowerプラグインを追加していないようですhttps://cordova.apache.org/docs/en/latest/reference/cordova-plugin-inappbrowser/ –

+0

InAppBrowserをインストールしましたが、ヘルプはありません。質問に追加したコードを確認してください。 –

答えて

0

ng-cordova.min.jsファイルをcordova.jsの前に置いて解決しました。 Cordova.jsファイルが最後に読み込まれます。

注:ng-cordovaが角度に依存するため、角度jsファイルを上記の2つ前に配置する必要があります。

そして、両方のファイルは、スタートアップのhtmlページにのみ存在する必要があります。

関連する問題