Preloading form scripts

  • Max
    Asked on October 22, 2021 at 10:41 AM

    Hello. Form JotForm works on our client's website.

    The problem is that google pagespeed is responsive to scripts of the JotForm form:

    /static/jotform.forms.js

    /static/prototype.forms.js

    Images in attachments.

    I tried to set the async and defer attributes. But it did not help.

    Please tell me how to postpone these scripts until the page is fully loaded.

    Thanks!

    Jotform Thread 3450904 Screenshot
  • Ivaylo JotForm Support
    Replied on October 22, 2021 at 11:05 AM

    What embed method do you use?

    I would suggest you to try iFrame. Since the form is displayed inside an iFrame, it might help. This guide will help you to obtain the iFrame code:

    https://www.jotform.com/help/148-getting-the-form-iframe-code

    Let us know, how it goes and if this helps.

  • Max
    Replied on October 22, 2021 at 12:04 PM

    Insert <script> is used. But how can you delay the loading of <iframe> tag?

  • Max
    Replied on October 22, 2021 at 12:06 PM

    Insert script is used. But how can you delay the loading of iframe tag?

  • Basil JotForm Support
    Replied on October 22, 2021 at 12:49 PM

    Hi,

    It is not possible to make any changes to the script code, please attempt using the iframe code instead of the script.

    Iframes allow using the Lazy loading property, which should delay loading them.

    https://web.dev/iframe-lazy-loading/

    If the issue persists, please provide the link to your page.

    Please let us know if you require any further assistance.