window.onload not working in modern sharepoint site

%3CLINGO-SUB%20id%3D%22lingo-sub-1104482%22%20slang%3D%22en-US%22%3Ewindow.onload%20not%20working%20in%20modern%20sharepoint%20site%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1104482%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20everyone%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe%20are%20trying%20to%20develop%20an%20extension%20for%20site%20Analytics%20in%20modern%20SharePoint%20site.%20In%20the%20applicationcustomizer.ts%20file%2C%20we%20have%20included%20a%20code%20fragment%20which%20uses%20window.onload%20function.%20But%20eventhough%20the%20site%20is%20fully%20loaded%20the%20function%20is%20never%20executed.%3C%2FP%3E%3CP%3EWe%20like%20to%20measure%20the%20load%20time%20for%20the%20site%2C%20once%20it%20finishes%20loading%20the%20site%20including%20every%20large%20images.%20Is%20there%20any%20suggested%20way%20for%20this%20functionality%20in%20SharePoint%20modern%20environment.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1104482%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EApp%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Server%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
New Contributor

Hi everyone,

 

We are trying to develop an extension for site Analytics in modern SharePoint site. In the applicationcustomizer.ts file, we have included a code fragment which uses window.onload function. But eventhough the site is fully loaded the function is never executed.

We like to measure the load time for the site, once it finishes loading the site including every large images. Is there any suggested way for this functionality in SharePoint modern environment.

1 Reply
Highlighted

Hey @Arjun_Suda_S ,

 

Not sure, but could it be that the window is already loaded when the extensions starts running? If you want some feedback for loading times in SharePoint, check out the Page DIagnostics Chrome extension that Microsoft developed. I've found it quite useful to track page loading time.

 

Regards,