Load javascript after page is completely loaded
-
- Posts: 3
- Joined: Sun Sep 18, 2016
In sharepoint I need to load javascript after page is completely rendered.
So this is what I did:
function LazyLoad(){
console.log("JS loaded after page rendering");
}
_spBodyOnLoadFunctionNames.push("LazyLoad");
I guess, _spBodyOnLoadFunctionNames can not access "LazyLoad" function because it is not defined globally. How to load the function "LazyLoad" after everything is initialized?
So this is what I did:
function LazyLoad(){
console.log("JS loaded after page rendering");
}
_spBodyOnLoadFunctionNames.push("LazyLoad");
I guess, _spBodyOnLoadFunctionNames can not access "LazyLoad" function because it is not defined globally. How to load the function "LazyLoad" after everything is initialized?
-
- Posts: 3
- Joined: Sun Sep 18, 2016
Got my solution:
ExecuteOrDelayUntilScriptLoaded(LazyLoad, "sp.ribbon.js");
ExecuteOrDelayUntilScriptLoaded(LazyLoad, "sp.ribbon.js");
-
- Posts: 3
- Joined: Sun Sep 18, 2016
he latest script that get's loaded is "sp.ui.spellcheck.js". (Actually it's "O365ShellG2Plus.js", but that does not load.)
So best answer:
ExecuteOrDelayUntilScriptLoaded(LazyLoad, "sp.ui.spellcheck.js");
So best answer:
ExecuteOrDelayUntilScriptLoaded(LazyLoad, "sp.ui.spellcheck.js");
-
- Information
-
Who is online
Users browsing this forum: No registered users and 7 guests