Embed the script after the page is loaded

  • Issue description:
    Is there a way to embed the app after the page has been load and not on load?

  • Link to the page with the widget in question:

1 Like

Hi @Kanika_Hotels_Resort :wave:

I see that my colleague Natalia has already contacted you. As Natalia said, you can make the widget load after the content of the page is loaded.

To do that, you will need to replace the first line of the widget code (<script src="https://apps.elfsight.com/p/platform.js" defer></script>) with the following script:

<script>
    window.addEventListener('load', () => {
      const script = document.createElement('script');
      script.setAttribute('src', 'https://static.elfsight.com/platform/platform.js');
      // script.setAttribute('data-use-service-core', 'true');
      document.head.appendChild(script)
    })
  </script>

If any other questions come up, please feel free to contact Natalia. She’ll be happy to help.

I would guess without more details that this is the answer to achieve what they need in a simpler way:

2 Likes