android - onDeviceReady never gets called in Cordova app -
i trying run simple page within inappbrowser plugin. running cordova 5.0, , plugin version 1.0. run app splashscreen plugin , seems work fin. default splashscreen runs when app start in app browser plugin not seem work. here code below:
<!doctype html> <html> <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/index.css"> <title>hello world</title> <script type="text/javascript" src="../platforms/android/assets/www/cordova.js"></script> <script type="text/javascript" charset="utf-8"> // wait cordova load // function onload() { document.addeventlistener("deviceready", ondeviceready, false); } // cordova ready // function ondeviceready() { alert("dfs"); var ref = window.open('http://apache.org', '_blank', 'location=yes'); ref.addeventlistener('loadstart', function(event) { alert('start: ' + event.url); }); ref.addeventlistener('loadstop', function(event) { alert('stop: ' + event.url); }); ref.addeventlistener('loaderror', function(event) { alert('error: ' + event.message); }); ref.addeventlistener('exit', function(event) { alert(event.type); }); } </script> </head> <body onload="onload()"> </body> </html>
the cordova.js file linked assume since correct path. have uninstalled , installed plugin back, created new project , none of them seem solve problem. testing on android 5.0 smartphone , android 4.1 emulator. ideas?
just include corodova.js follows
<script type="text/javascript" src="cordova.js"></script>
and use ripple emulator [which google plugin] , see ondeviceready() fired. acutually works me. please try it
Comments
Post a Comment