Skip to content

loading 3rd party scripts inside the page #633

Closed Answered by daun
andresclua asked this question in Help
Discussion options

You must be logged in to vote

I think the way the scripts plugin re-runs scripts is asynchronous, so your second script tag will be executed before the first one is fully loaded. You could try a script loader like load-script-once and then execute the second part with forms.create in the callback.

<script>
  loadScriptOnce('//js.hsforms.net/forms/embed/v2.js').then(() => {
    hbspt.forms.create({})
  })
</script>

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
5 replies
@andresclua
Comment options

@daun
Comment options

daun Mar 16, 2023
Maintainer

@andresclua
Comment options

@daun
Comment options

daun Mar 16, 2023
Maintainer

@andresclua
Comment options

Comment options

You must be logged in to vote
2 replies
@andresclua
Comment options

@daun
Comment options

daun Mar 17, 2023
Maintainer

Answer selected by daun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants