• Resolved emilbroll

    (@emilbroll)


    Hey!

    We’ve occasionally seen response times for the uc.js-script at more than 5s, and with only the async-attribute set in the script tag, this blocks rendering.
    Could you consider adding the defer-attribute to the script, so it won’t block parsing?

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author cookiebot

    (@cookiebot)

    Hi @emilbroll

    Thanks for reaching out!

    defer will be added as as an option in the plugin on next release.

    We’ll update you here once it’s released.

    Plugin Contributor Johan Holst Nielsen

    (@phpgeekdk)

    Hi @emilbroll

    We have included the requested feature in the version released few minutes ago (version 2.1.5).

    You are now able to choose none, defer or async as attribute the cookie declaration tag as well as the cookie consent banner tag.

    Thread Starter emilbroll

    (@emilbroll)

    Fantastic, thanks a lot for the fast action! ??

    Thread Starter emilbroll

    (@emilbroll)

    Hey! A follow-up from me – it would be great to be able to add both the async and defer-attributes at the same time (or neither) – is this possible to implement?

    Plugin Contributor Johan Holst Nielsen

    (@phpgeekdk)

    Hi @emilbroll

    We didn’t include the option to choose both defer and async to keep it a bit more simple for non-technical users.

    The situations where both async and defer works are pretty rare. By default browsers will use async if both async and defer are specified – the only time defer comes into effect will be on pretty old browsers that nor supports async (https://www.w3.org/TR/2011/WD-html5-20110525/scripting-1.html#attr-script-async). All major (and even minor) browsers support async nowadays. The only browser I am aware of not supporting async is Opera Mini – and it does not support defer as well ?? (https://caniuse.com/#feat=script-async)

    There should also be a setting for none. So that part should be covered ??

    Let me know if you have further questions.

    Thread Starter emilbroll

    (@emilbroll)

    I see! Thanks for that, I didn’t know ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Defer Javascript’ is closed to new replies.