My colleague Wouter just came up with a solution for some issues we were dealing with here at Tam Tam.
Using window.onload = function() ... in javascript breaks SharePoint's own system of getting functions run when the page is loaded. Two problems that I've seen as a result:
- menus not folding out
- Explorer view not working
This is how the SharePoint "on load" system works:
the body tag has this onload attribute:
onload="javascript:if (typeof(_spBodyOnLoadWrapper) != 'undefined') _spBodyOnLoadWrapper();",
meaning: if "_spBodyOnLoadWrapper" exists, run it.
"_spBodyOnLoadWrapper" will execute all functions in the array "_spBodyOnLoadFunctionNames"
this array gets filled like this: _spBodyOnLoadFunctionNames.push("ExpGroupOnPageLoad");
When you use window.onload = function() ... for instance in core.js, it will replace the onload of the body, so "_spBodyOnLoadWrapper" will not be run. This means all the functions SharePoint wants to run on load are not run, which can cause various problems.
Solution:
Instead of using something like this:
window.onload = function() {
randomizePicture();
delayMenu();
}
use this:
_spBodyOnLoadFunctionNames.push('randomizePicture');
_spBodyOnLoadFunctionNames.push('delayMenu');