I am working on a Vue component that will be placed on multiple websites via a CMS system. The issue I encounter is that even if my js scripts loading order is correct, sometime
Use the load event to wait until all resources have finished loading:
Further explanation
DOMContentLoaded
is an event fired when the HTML is parsed and rendered and DOM is constructed. It is usually fired pretty fast in the lifetime of the app. On the other hand,load
is only fired when all the resources (images, stylesheets etc.) are retrieved from the network and available to the browser.
You can also use the load event for a specific script.