I was wondering if this is something normally done or possible (I am a novice)
suppose you have kind of a heavy javascripted site. A web app page basically. What if part of the page is a mailbox… and the user doesn’t necessarily use it right away. Could you possibly download the javascript that the mailbox requires after the page has loaded or maybe even as they need to use the mailbox? I saw this from another question:
$.getScript("my_lovely_script.js", function(){
alert("Script loaded and executed.");
Yes, you can load non-essential scripts “later” to avoid processing them before displaying the initial page.
There are several approaches:
<body>right before the</body>tag so the page can display before they are loaded.Before you proceed down this path, I would highly suggest that you measure the loading resources of your page and find out where the time is really going. Premature optimization before you’ve measured where the time is actually going is rarely the most effective way to improve things. The Chrome debugger can show you a lot of data about resource load times.
Also, remember that a design that optimizes for effective caching can be highly effective since one your scripts are loaded for the first page on your site, they will be cached for all future pages and will load very, very quickly from the browser disk or memory cache.