Load javascript after page is completely loaded

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
peisenschmidt
Posts: 3
Joined: Sun Sep 18, 2016

19 Sep 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?

peisenschmidt
Posts: 3
Joined: Sun Sep 18, 2016

19 Sep 2016

Got my solution:

ExecuteOrDelayUntilScriptLoaded(LazyLoad, "sp.ribbon.js");

peisenschmidt
Posts: 3
Joined: Sun Sep 18, 2016

19 Sep 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");

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 7 guests