Software Archive
Read-only legacy content
17061 Discussions

script not runXDK HTML5 CORDOVA

Paolo_p_3
Beginner
250 Views

Good Morning,

I created an App with HTML5 and Cordova and I set a javascript function in the body onload but does not enter there.

I installed the last version of XDK and that work fine on old version.

this is extract of code not working

<body onload="inizia();" style="background-color: #ffffff">

<script>

function inizia() {

alert('1');

   document.addEventListener("deviceready", onDeviceReady,false) ;

If I insert a alert direct in onload work corretly

<body onload="alert('1');" style="background-color: #ffffff">

I have move the script code in the head tag but the problem persist

Thanks

0 Kudos
1 Reply
PaulF_IntelCorp
Employee
250 Views

I'm assuming you are testing this in the Simulate tab. I recommend you use console.log() messages not alerts to test this. You might have a  problem with the function definition. Try defining inizia() this way, instead:

var inizia = function() {
    ...your code here...
} ;

 

0 Kudos
Reply