question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

callback functions not firing when embed is loaded in HTML from CDN

See original GitHub issue

Hi folks, we use the onSubmit callback function to perform some handling but this stopped working in the last couple of days. The way we load the embed library is as described in the first code snippet here. You can see a similar sample project at https://boulder-smart-aragon.glitch.me/. The console logs inside of the callback functions never get called.

On the other hand, if using the second method from the linked documentation then it seems to work. A sample project, logging the same events as the previous project, can be found at https://mixed-power-ocelot.glitch.me/.

For our use case we can probably switch to the second method, but it looks like something might have broken the functionality for the first method. Or I’m doing something wrong that I haven’t noticed!

Any help would be appreciated, thank you.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
shatrancommented, Aug 23, 2021

Also experienced the same issue, also started 4 days ago, which caused our site and analytics to freak out (we use the onSubmit callback to redirect to a completion page, as the form is embedded in an iframe on a Wix site). Just tried @martino2k6’s solution and it seems to work. Maybe worth changing the examples in the docs for other users.

2reactions
martino2k6commented, Aug 20, 2021

We have just discovered that putting the <script>...</script> section with the callback functions before <script src="//embed.typeform.com/next/embed.js"></script> has made it work, but we’ve always had the load script first as far as I can tell from out VCS history 🤷‍♂️

EDIT: Working example at https://glitch.com/edit/#!/aboard-polarized-pincushion.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Callback function not executing click after .load()
load () I create a call back function which executes .unitegallery() . Unitegallery() successfully executes and beautifully creates the image ...
Read more >
External script doesn't always load when added to Nuxt page ...
callback () function is not called. is this expected if the JS is cached? or should this callback be fired no matter what?...
Read more >
Resource loading: onload and onerror
Let's say we need to load a third-party script and call a function that resides there. We can load it dynamically, like this:....
Read more >
How to Handle the JavaScript onload Event
In this tutorial, you will learn how to handle the load event that fires on the document, image, and script elements in JavaScript....
Read more >
RequireJS API
RequireJS waits for all dependencies to load, figures out the right order in which to call the functions that define the modules, then...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found