jquery - Loading Javascript files sequentially in <body> and fire callback on completion -
i have weebsite (cordova/phonegap app actually) has in <head>
:
<script type="text/javascript" src="cordova.js"></script> <script type="text/javascript" src="apppolyfills.js"></script> <script type="text/javascript" src="applibs.js"></script> <script type="text/javascript" src="app.js"></script>
this works fine, website scripts quite heavy, while scripts parsed, html of page not displayed.
i want html of page displayed, , load scripts above.
i know can load scripts in <body>
tag, in case must absolutly load these scripts sequentially.
so want is:
- make html display on startup before loading script
- load scripts sequentially in body
- be notified when last script (app.js) loaded, can start app (as document ready event has fired, need one)
is possible?
i can accept jquery based solution prefer raw javascript.
you can put script-tags after body , can place own script after included scripts
... </body> <script type="text/javascript" src="cordova.js"></script> <script type="text/javascript" src="apppolyfills.js"></script> <script type="text/javascript" src="applibs.js"></script> <script type="text/javascript" src="app.js"></script> <script> starttheapp(); // call function when "app.js" ready </script> </html>
Comments
Post a Comment