Olá! Nós temos uma Comunidade em Português!

Is it possible to add javascript with defer attribute in hubspot template

Highlighted
Mitwirkender

Is it possible to add javascript with defer attribute in hubspot template

Responder
0 Avaliação positiva
1 Resposta 1
Community-Manager

Hi @nutanhaspe,

 

I hope all is well with you 😄

 

By defer attribute do you mean something like this:

<script defer="defer">
	//do stuff, but defer it  (runs last)
</script>

If so, I have tested it out and it works! This is the sample code that I ran:

<!doctype html>
<html lang="{{ html_lang }}" {{ html_lang_dir }}>
    <head>
        <meta charset="utf-8">
        <meta name="description" content="{{ page_meta.meta_description }}">
        <title>{{ page_meta.html_title }}</title>
        {% if site_settings.favicon_src %}<link rel="shortcut icon" href="{{ site_settings.favicon_src }}" />{% endif %}
        {{ standard_header_includes }}

    </head>

    <body>

        {{ standard_footer_includes }}
                    <script defer="defer">
      alert("helloworld");
      
      </script>
    </body>
</html>

I created a page based off this template and was able to see the alert pop up.

Responder
0 Avaliação positiva