function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mukesh guptamukesh gupta 

Window.load() for Lightning

Hi, 

I am using window.load() in visualforce page, but in lightning readiness report , window.load() does not support in Lightning. Message is  below:- 

"JavaScript included in this page uses window. methods. Included JavaScript uses window. methods for navigation, which are not supported in Lightning Experience."

Can you please suggest , what substitute i can use instead of window.load() for Lightning;

Thanks
Mukesh
 
Raj VakatiRaj Vakati
Yes but you can do it as below 
  1.  Can you try to use the Static resource and move all code there which need to be fired on the onload 
  2. use ltng:required afterScriptsLoaded  method
 
<ltng:require scripts="{!$Resource.***resourceName***}" afterScriptsLoaded="{!c.afterScriptsLoaded}" />


https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/js_libs_platform.htm