Skip to content

Instantly share code, notes, and snippets.

@sergey-tihon
Created March 27, 2012 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergey-tihon/2217620 to your computer and use it in GitHub Desktop.
Save sergey-tihon/2217620 to your computer and use it in GitHub Desktop.
script loading
before:
<body onload="javascript:if (typeof(_spBodyOnLoadWrapper) != 'undefined') _spBodyOnLoadWrapper();">
after:
<script type="text/javascript">
var attempts_remain = 200;
function _lazySpBodyOnLoadWrapper() {
if (typeof(_spBodyOnLoadWrapper) == 'undefined' || !(document.readyState === "complete")) {
if (attempts_remain > 0) {
attempts_remain--;
setTimeout(_lazySpBodyOnLoadWrapper, 50);
}
return;
}
_spBodyOnLoadWrapper();
attempts_remain = 0;
};
_lazySpBodyOnLoadWrapper();
</script>
</head>
<body onload="_lazySpBodyOnLoadWrapper();">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment