• Hi, I am the developer of WP Fastest Cache. I want to ask a question. If you answer it, you make me so happy.

    I want to load the sources as defer and move the inline js to top of the js sources.

    The sources are loaded as on the first example but I want to replace them as on the second example. does it cause any problem?

    Original

    <script src='https://www.wp.org/wp-content/plugins/wpforms/pro/assets/js/vendor/jquery.intl-tel-input.min.js?ver=15.0.0'></script>
    <script src='https://www.wp.org/wp-content/plugins/wpforms/assets/js/jquery.validate.min.js?ver=1.19.0'></script>
    <script src='https://www.wp.org/wp-content/plugins/wpforms/assets/js/mailcheck.min.js?ver=1.1.2'></script>
    <script src='https://www.wp.org/wp-content/plugins/wpforms/assets/js/wpforms.js?ver=1.5.5.2'></script>
    <script>
    var wpforms_settings = {"val_required":"This field is required.","val_url":"Please enter a valid URL.","val_email":"Please enter a valid email address.","val_email_suggestion":"Did you mean {suggestion}?","val_email_suggestion_title":"Click to accept this suggestion.","val_number":"Please enter a valid number.","val_confirm":"Field values do not match.","val_fileextension":"File type is not allowed.","val_filesize":"File exceeds max size allowed.","val_time12h":"Please enter time in 12-hour AM\/PM format (eg 8:45 AM).","val_time24h":"Please enter time in 24-hour format (eg 22:45).","val_requiredpayment":"Payment is required.","val_creditcard":"Please enter a valid credit card number.","val_smart_phone":"Please enter a valid phone number.","val_post_max_size":"The total size of the selected files {totalSize} Mb exceeds the allowed limit {maxSize} Mb.","val_checklimit":"You have exceeded the number of allowed selections: {#}.","post_max_size":"2097152000","uuid_cookie":"1","locale":"en","wpforms_plugin_url":"https:\/\/www.wp.org\/wp-content\/plugins\/wpforms\/","gdpr":"","ajaxurl":"https:\/\/www.wp.org\/wp-admin\/admin-ajax.php","mailcheck_enabled":"1","mailcheck_domains":[],"mailcheck_toplevel_domains":[],"currency_code":"USD","currency_thousands":",","currency_decimal":".","currency_symbol":"$","currency_symbol_pos":"left"}
    </script>

    I want to replace as below

    <script>
    var wpforms_settings = {"val_required":"This field is required.","val_url":"Please enter a valid URL.","val_email":"Please enter a valid email address.","val_email_suggestion":"Did you mean {suggestion}?","val_email_suggestion_title":"Click to accept this suggestion.","val_number":"Please enter a valid number.","val_confirm":"Field values do not match.","val_fileextension":"File type is not allowed.","val_filesize":"File exceeds max size allowed.","val_time12h":"Please enter time in 12-hour AM\/PM format (eg 8:45 AM).","val_time24h":"Please enter time in 24-hour format (eg 22:45).","val_requiredpayment":"Payment is required.","val_creditcard":"Please enter a valid credit card number.","val_smart_phone":"Please enter a valid phone number.","val_post_max_size":"The total size of the selected files {totalSize} Mb exceeds the allowed limit {maxSize} Mb.","val_checklimit":"You have exceeded the number of allowed selections: {#}.","post_max_size":"2097152000","uuid_cookie":"1","locale":"en","wpforms_plugin_url":"https:\/\/www.wp.org\/wp-content\/plugins\/wpforms\/","gdpr":"","ajaxurl":"https:\/\/www.wp.org\/wp-admin\/admin-ajax.php","mailcheck_enabled":"1","mailcheck_domains":[],"mailcheck_toplevel_domains":[],"currency_code":"USD","currency_thousands":",","currency_decimal":".","currency_symbol":"$","currency_symbol_pos":"left"}
    </script>
    <script defer src='https://www.wp.org/wp-content/plugins/wpforms/pro/assets/js/vendor/jquery.intl-tel-input.min.js?ver=15.0.0'></script>
    <script defer src='https://www.wp.org/wp-content/plugins/wpforms/assets/js/jquery.validate.min.js?ver=1.19.0'></script>
    <script defer src='https://www.wp.org/wp-content/plugins/wpforms/assets/js/mailcheck.min.js?ver=1.1.2'></script>
    <script defer src='https://www.wp.org/wp-content/plugins/wpforms/assets/js/wpforms.js?ver=1.5.5.2'></script>
    • This topic was modified 5 years, 2 months ago by Emre Vona.
    • This topic was modified 5 years, 2 months ago by Emre Vona.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Following. I purchased WP forms for several sites now, so I would really like to see better speed results. Thank you.

    Plugin Support Ethan Choi

    (@ethanchoi)

    Hi @emrevona and @lowthian,

    I’ve checked with our developer and it looks like the suggested changes might result in errors, unfortunately.

    This is because in wpforms.js we use libraries like mailcheck and validate in a way that follows our current loading order, where wpforms.js always loads last after all libraries are loaded. If a defer attribute is added, this might change the loading order and the plugin JS functions may not work as expected.

    Hey @lowthian, if you encounter any speed issues when using WPForms Lite, could you share in a new post when you get the chance? That way we can better address your concerns.

    Thanks!

    Greetings @ethanchoi,
    I am using wpforms pro, would you still like me to post there?

    Thanks.

    Thread Starter Emre Vona

    (@emrevona)

    @ethanchoi , thank you for the answer but you did not pay attention.
    I did not change the order of the js sources except the inline js.

    Plugin Support Ethan Choi

    (@ethanchoi)

    Hi @emrevona, I apologize! We’ve looked into the code again and yes, it should work though we recommend testing it extensively ??

    Hi @lowthian, thanks for letting me know! As a license holder, please feel welcome to contact us by submitting a support ticket. Thanks!

    Thread Starter Emre Vona

    (@emrevona)

    thank you @ethanchoi , I wanna ask again to be sure.
    To move the inline javascript to the top and adding “defer” attribute does not cause any problem, right?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Load the sources as defer’ is closed to new replies.