Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why js not working in cordova?

I'm trying to run this code in browser and in emulator, but js is not working. In emulator sidebar does not open while in browser sidebar always opens.

How to fix this issue?

<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>
like image 815
user3819738 Avatar asked Dec 18 '22 15:12

user3819738


1 Answers

Replace your first meta tag with this meta tag.

<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'"/>
like image 113
Dinesh Belkare Avatar answered Dec 28 '22 07:12

Dinesh Belkare