I have a share point site i noticed the menu loads slow.its a customized menu based on a list and jquery.I load the script on my masterpages I would prefer this menu to load last after all the other script has loaded. I read about scriptlink vs traditional script tag but not sure if this will help. Any tips,ideas and resources would be appreciated. Cheers
1 Answer
"If you aren't dynamically loading scripts or marking them as defer or async, then scripts are loaded in the order encountered in the page. It doesn't matter whether it's an external script or an inline script - they are executed in the order they are encountered in the page. Inline scripts that come after external scripts have are held until all external scripts that came before them have loaded and run.
Async scripts (regardless of how they are specified as async) load and run in an unpredictable order. The browser loads them in parallel and it is free to run them in whatever order it wants.
There is no predictable order among multiple async things. If one needed a predictable order, then it would have to be coded in by registering for load notifications from the async scripts and manually sequencing javascript calls when the appropriate things are loaded.
When a script tag is inserted dynamically, how the execution order behaves will depend upon the browser. You can see how Firefox behaves in this reference article. In a nutshell, the newer versions of Firefox default a dynamically added script tag to async unless the script tag has been set otherwise."
From this forum
load and execute order of scripts.
Hope this helps!
[EDIT] Based on your comment:
If you are looking for the SPLongOperation. Please have a look here http://www.sharemuch.com/2010/01/22/displaying-sharepoint-2010-processing-page-during-your-long-running-custom-operations/
http://bramdejager.wordpress.com/2011/03/21/using-sp-ui-dialog-and-sp-ui-notify-from-code-behind/
https://stackoverflow.com/questions/2813590/ajax-loading-icon-with-updatepanel-postbacks
-
Thanks Anuja. How about showing a loading... button and then after the data is loaded append to element. cheers Commented Nov 5, 2012 at 12:31