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 has been done on purpose - to ensure that optimal webpage loading speed is maintained, avoiding any potential slowdowns.

However, if the widget is the first thing your clients see when entering the website, this great feature may cause more harm than good. Fortunately, we have a solution that can help. 

This tutorial explains how to make the widget appear faster on your website. In case increasing PageSpeed score is what you're interested in, please refer to the following article - How to improve PageSpeed score of a page with our widget.

By default, every installation code has a 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.

In order to make the widget appear faster on the page, you need to replace the defer attribute in the installation code of the widget with the async attribute.

Here's an example of the installation code with the async attribute instead of defer. 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):

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

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us