html - My first APP, Cordova and iOS -


i'm trying simple app phonegap (cordova 3.0.0) on ios. here index.html:

<!doctype html> <head> <title>app</title> <script type="text/javascript" charset="utf-8" src="cordova.js"></script> <script type="text/javascript" charset="utf-8">     function onload() {         document.addeventlistener("deviceready", ondeviceready, false);     }      function ondeviceready() {         alert("hello!");     } </script> </head>  <body onload="onload()">     hola     <br />     <a href="http://www.google.es" target="_blank"> pulsame </a>     <div id="idi"></div> </body> </html> 

but nothing happens. device never ready, never shows alert. think problem cordova.js, can't find problem (the proyect created fine , runs).

any help?

don't use onload function attach listener. instead attach listener, use ondeviceready function if onload. should this:

<!doctype html> <head> <title>smartpol</title> <script type="text/javascript" charset="utf-8" src="cordova.js"></script> <script type="text/javascript" charset="utf-8">     document.addeventlistener("deviceready", ondeviceready, false);      function ondeviceready() {         alert("hello!");     } </script> </head>  <body>     hola     <br />     <a href="http://www.google.es" target="_blank"> pulsame </a>     <div id="idi"></div> </body> </html> 

also, if want attach other event listeners can after ondeviceready has fired.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -