为什么js不在cordova工作?

时间:2016-07-07 10:18:14

标签: javascript jquery html cordova

我试图在浏览器和模拟器中运行此代码,但js无效。 在模拟器侧边栏中,当浏览器侧边栏始终打开时,侧边栏不会打开。

如何解决此问题?

<head>
    <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
    <meta name="format-detection" content="telephone=no">
    <meta name="msapplication-tap-highlight" content="no">
    <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
    <link rel="stylesheet" type="text/css" href="css/jquery.mobile-1.4.5.min.css">
    <link rel="stylesheet" type="text/css" href="css/materialize.min.css">
    <link rel="stylesheet" type="text/css" href="css/material-design-iconic-font.min.css">
    <title>App</title>
</head>
<body>
<div data-role="page" id="page1">
  <nav class="blue lighten-1">
    <ul id="slide-out" class="side-nav fixed">
        <li class="bold"><a href="#!" class="waves-effect waves">First Sidebar Link</a></li>
        <li class="bold"><a href="#!" class="waves-effect waves">Second Sidebar Link</a></li>
      </ul>
    <a href="#" data-activates="slide-out" class="button-collapse"><i class="zmdi zmdi-menu"></i></a>
  </nav>
  </div>
  <script type="text/javascript" src="cordova.js"></script>
  <script type="text/javascript" src="js/jquery.js"></script>
  <script type="text/javascript" src="js/materialize.min.js"></script>
  <script type="text/javascript" src="js/jquery.mobile-1.4.5.min.js"></script>
  <script>
   $(document).ready(function(){
     $('.button-collapse').sideNav();
    });
  </script>
</body>

1 个答案:

答案 0 :(得分:9)

用此元标记替换您的第一个元标记。

&#13;
&#13;
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'"/>
&#13;
&#13;
&#13;