Q:

javascript lazy loading in android hybrid app

I have this code the head section of an html page 
<script type="text/javascript" src="js/head.load.min.js"></script>
<script type="text/javascript">
    head.js("js/jquery.js","docs/_assets/js/jqm-docs.js","js/jquery.mobile-  1.1.1.js",function(){alert('scripts have been loaded')});
</script>

My javascript files as well as my css and and html files are in the assests folder in an android project.What I am trying to do is load the javascript files asynchronously from the assests folder so that the initial rendering of a html page in the webview is fast. But this doesn't seem to work as it is not loading the javascript files.what can be the reason ??
By the way I am using headjs javascript library for async load..here is the site reference http://headjs.com/

A:

Have you looked at any of the async loaders, such as requireJS?
The question is what you are trying to achieve, because from your code I can see you are loading Jquery Mobile, which enhances most elements on the page. So until JQM is done loading and has initialized I would not want to show anything to the user, because he will then see the "pre-JQM-enhanced" content. 
So either put the js files into your head section like so:
<script type="text/javascript" src="jquery"></script>
<script type="text/javascript" src="jqm-docs"></script>
<script type="text/javascript" src="jqm"></script>

Which will load them straight up (not async) and only show content once everything is running, or use an async loader. However this will not change the end result, because your page seems to need at least jquery and jqm, so you cannot "start" your app without them having loaded. 
When using an async loader you have to keep in mind, how js files depend on one another. Jquery Mobile requires Jquery, so until Jquery is loaded you better not initialize Jquery Mobile.  

