This is in reference to SharePoint 2010.
I am writing some custom javascript that needs to know when the page has finished loading. To accomplish this I am pushing my callback function on to the _spBodyOnLoadFunctionNames array. This works great most of the time, but will sporadically fail and my handler will never get called.
Tracing it back, it looks like this array is never getting flushed because of issues with loading core.js.
In _spBodyOnLoadWrapper in init.js there is the call below which initiates the array being flushed. The ProcessDefaultOnLoad function is never getting called, and core.js does not show up as being loaded in the browser. The page appears to function just fine, but none of the functions in _spBodyOnLoadFunctionNames get called.
ExecuteOrDelayUntilScriptLoaded(ProcessDefaultOnLoad, "core.js");
Is _spBodyOnLoadFunctionNames the proper way to determine when a page has finished loading? Is there anything that would cause core.js not to be loaded?
A few more data points:
I have only seen the issue in Chrome. With it being sporadic I can't say for sure that it never happens in other browsers.
It appers to be happening more often after clearing the cache. Perhaps its a timing issue?