Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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