# Scripts not loaded synchonously?

**URL:** <https://forum.bubble.io/t/scripts-not-loaded-synchonously/100710>\
**Category:** Need help\
**Created:** [July 7, 2020, 9:35pm UTC](https://forum.bubble.io/t/scripts-not-loaded-synchonously/100710 "2020-07-07T21:35:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![senica](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/senica/32/65862_2.png) [@senica](https://forum.bubble.io/u/senica)\
**Post date:** [July 7, 2020, 9:35pm UTC](https://forum.bubble.io/t/scripts-not-loaded-synchonously/100710/1 "2020-07-07T21:35:24Z")

</div>

Hi, I’m new to Bubble.

I’m trying to use an HTML element to embed some javascript code.

I have to load an external script, then reference a variable that script loads.

For example:

```
<script type="text/javascript" src="https://assets.calendly.com/assets/external/widget.js"></script>
<script> console.log(Calendly); </script>

```

If I do this, `Calendly` is not defined. But, if I open up the console after the page is loaded and type in Calendly, it displays an object as expected.

It seems like Bubble changes script tags to be asyncronous…is that possible?

What would be a fix for this situation? Seems simple enough, and doesn’t seem like this simple code is worth making a plugin for.

---

<div class="post-metadata">

**Author:** ![senica](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/senica/32/65862_2.png) [@senica](https://forum.bubble.io/u/senica)\
**Post date:** [July 7, 2020, 9:55pm UTC](https://forum.bubble.io/t/scripts-not-loaded-synchonously/100710/2 "2020-07-07T21:55:43Z")

</div>

Got it. Here for anyone else

```auto
<div class="calendly-inline-widget" style="min-width:320px;height:900px;" data-auto-load="false" id="calendly-frame"></div>

<script>
    let head = document.querySelector('head');
    let script = document.createElement('script');
	script.type = 'text/javascript';
	script.onload = function() {
    	Calendly.initInlineWidget({
            url: '',
            parentElement: document.getElementById('calendly-frame'),
            prefill: {},
            utm: {}
        });
	}
	script.src = 'https://assets.calendly.com/assets/external/widget.js';
	head.appendChild(script);
</script>

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/bubble/original/3X/2/8/2847faa74692c2ffa5d939d3dc3724cdd060d247.png) [@system](https://forum.bubble.io/u/system)\
**Post date:** [September 15, 2020, 9:35pm UTC](https://forum.bubble.io/t/scripts-not-loaded-synchonously/100710/3 "2020-09-15T21:35:24Z")

</div>

Closed on September 15, 2020, 9:35pm UTC

This topic was automatically closed after 70 days. New replies are no longer allowed.
