Script Loader

The Edgemesh® Script Loader is a powerful tool for developers to optimize the loading and execution of JavaScript on their websites. By leveraging the Script Loader, you can significantly improve the performance of your web pages.

How to Use

The Script Loader feature is configured by setting the script element's type attribute to one of the Edgemesh® Script Loader values. The available values are listed below. We go into depth into each of these types in the reference.

  • edgemesh/beforeInteractive: Loads the script before the page is interactive.
  • edgemesh/afterInteractive: Loads the script after the page is interactive.
  • edgemesh/lazyOnLoad: Loads the script after the onLoad event.
  • edgemesh/worker: Loads the script in a Web Worker. Coming Soon

What it Does

By changing the type attribute to one of these values, the browser will skip parsing and executing that script element, allowing the parser to process the entire page quickly. This eliminates the delay typically associated with adding third-party resources. It's important to note that the Edgemesh® Client script itself cannot be optimized by the Script Loader. When the Edgemesh® Client loads, it will handle loading each script at the appropriate time in the page's lifecycle. This optimization leads to significant improvements in time to interactive (TTI), first contentful paint (FCP), largest contentful paint (LCP), and total blocking time (TBT).

Automated Configuration

At the current time, automated configuration of the script loader is only available for Edgemesh® Server customers. Contact sales to see if your site is eligible for Edgemesh® Server!

For Edgemesh® Server Customers, the Script Loader can be configured to automatically optimize known compatible scripts. For all other scripts, we recommend using the data-em-load attribute rather than the type attribute. This approach is inert and will always render regardless if the request is served by Edgemesh® Server (staging sites, preview themes, etc...).

Made withby Edgemesh Corporation