How to make a widget load faster

Sometimes, your Elfsight widget may take a while to load on your website. This happens because our widgets are set to load after the rest of the content has loaded. This ensures that your webpage maintains optimal loading speed, avoiding any potential slowdowns.

However, if the widget is the first thing your clients see when entering the website, this feature may cause more harm than good. Fortunately, we have a solution to make the widget appear faster.

This tutorial explains how to make the widget load faster on your website. If you're interested in increasing your PageSpeed score, please refer to this article - How to improve PageSpeed score of a page with our widget.

By default, every installation code has the defer attribute. Thanks to this attribute, the script in the widget's installation code is downloaded in parallel with parsing the page and executed only after the page has finished parsing.

To make the widget appear faster, you need to replace the defer attribute in the installation code with the async attribute. This way, the widget's code is downloaded in parallel with parsing the page and executed as soon as it is available (before parsing completes).

Here’s an example of the installation code with the async attribute instead of defer:

With these changes, your widget's loading speed on your webpage should significantly improve.

Did this article answer your question? Share your feedback: Thanks for sharing your feedback. It helps us grow! There was a problem submitting your feedback. Please try again later.

Still looking for assistance? Contact Us Contact Us