Software Archive
Read-only legacy content
17061 Discussions

Start script on page load only happens once (document.ready)

Youssef_A_
Beginner
435 Views

I have 2 html files within my project: index.html and itemsList.html.

On start of the application a javascript code is started on index.html here is the index_user_scripts.js:

(function()
{
 "use strict";
 /*
   hook up event handlers 
 */
 function register_event_handlers()
 {
    
    
  $( document ).ready(function() {
      
            alert("index document is ready");

        });
       
     
    $(document).on("click", "#buttonSignIn", function(evt)
    {
                
activate_page("itemsList.html");
         return false;
    });
    
        /* a  #buttonSignIn */
    
    
    }
 document.addEventListener("app.Ready", register_event_handlers, false);
    
    
    
})();

I tried to do the same on the itemsList.html, but it doesn't work. I also tried: window.load, <body onload="script()">. Is there another way to start a script after loading html page on the xdk?

0 Kudos
1 Reply
PaulF_IntelCorp
Employee
435 Views

Building multi-page apps in a Cordova app is tricky. We recommend you build a single-page app. See this Corodva doc > https://cordova.apache.org/docs/en/latest/guide/next/ <

0 Kudos
Reply