# Embed code loads blank form

**URL:** <https://community.hubspot.com/t/embed-code-loads-blank-form/53829>\
**Category:** Lead Capture Tools\
**Created:** [March 25, 2022, 12:51pm UTC](https://community.hubspot.com/t/embed-code-loads-blank-form/53829 "2022-03-25T12:51:13Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![BFranklin9](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/bfranklin9/32/194151_2.png) [@BFranklin9](https://community.hubspot.com/u/BFranklin9)\
**Post date:** [March 25, 2022, 12:51pm UTC](https://community.hubspot.com/t/embed-code-loads-blank-form/53829/1 "2022-03-25T12:51:13Z")

</div>

I am trying to embed a form on an external website. I am using the standard embed code, like this:

```lia-code-sample
<!--[if lte IE 8]>
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"></script>
<![endif]-->
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"></script>
<script>
hbspt.forms.create({
region: "na1",
portalId: "PORTALID",
formId: "FORMID"
});
</script>

```

(Obviously I’m using actual values instead of PORTALID and FORMID.)

The script runs just fine and creates an iframe on the page, but the markup inside the page is empty:

`<html><head></head><body data-autofill-highlight="false"></body></html>`

There are no errors in the console nor failed requests in the network tab.

I have tried with several forms and get the same results each time. The forms are published and the preview page loads just fine from within HubSpot itself.

I have tried this on its own in a plain HTML file and get the same results, so it’s not some other scripts on the website interfering.

I wondered if there could be options somewhere which limit the domains this can run on, but wasn’t able to find such options - and would expect an error to be thrown if that were the case anyway.

Any help would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![TitiCuisset](https://avatars.discourse-cdn.com/v4/letter/t/8baadc/32.png) [@TitiCuisset](https://community.hubspot.com/u/TitiCuisset)\
**Post date:** [March 28, 2022, 8:42am UTC](https://community.hubspot.com/t/embed-code-loads-blank-form/53829/2 "2022-03-28T08:42:04Z")

</div>

Hi @BFranklin9

Thank you for reaching out.

Could you share the external website page?

I want to tag some of our experts on this - @Kevin-C [@Jake\_Lett](https://community.hubspot.com/t5/user/viewprofilepage/user-id/72866) @Brownstephen101 do you know what could be happening here?

Thank you!

Best

Tiphaine

---

<div class="post-metadata">

**Author:** ![BFranklin9](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/bfranklin9/32/194151_2.png) [@BFranklin9](https://community.hubspot.com/u/BFranklin9)\
**Post date:** [March 29, 2022, 8:42am UTC](https://community.hubspot.com/t/embed-code-loads-blank-form/53829/3 "2022-03-29T08:42:38Z")

</div>

Hi [@TitiCuisset](https://community.hubspot.com/t5/user/viewprofilepage/user-id/89150),

The page is at [https://cpg-softlaunch.quba.co.uk/en-gb/talk-to-us/](https://cpg-softlaunch.quba.co.uk/en-gb/talk-to-us/). I have realised that the form works just fine on Chrome, but not on Firefox (even with Enhanced Tracking Protection off). If I hit F5 a bunch of times it will occasionally load, maybe 1 out of 5 times.

Thanks,

Ji

---

<div class="post-metadata">

**Author:** ![BFranklin9](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/bfranklin9/32/194151_2.png) [@BFranklin9](https://community.hubspot.com/u/BFranklin9)\
**Post date:** [March 29, 2022, 9:49am UTC](https://community.hubspot.com/t/embed-code-loads-blank-form/53829/4 "2022-03-29T09:49:28Z")

</div>

If I use the raw HTML option instead of iframe this seems to work fine - and as I’m wanting to style it up with custom CSS this is the right option for me anyway.

---

<div class="post-metadata">

**Author:** ![Jake\_Lett](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jake_lett/32/45178_2.png) [@Jake\_Lett](https://community.hubspot.com/u/Jake_Lett)\
**Post date:** [March 29, 2022, 10:47am UTC](https://community.hubspot.com/t/embed-code-loads-blank-form/53829/5 "2022-03-29T10:47:46Z")

</div>

Not sure if this is the issue, but Firefox has some unique security/privacy features that might block the iframe content. But if you can use the Raw HTML vs iframe that would be ideal because it gives you more control of what happens on the page.

[https://support.mozilla.org/en-US/kb/enhanced-tracking-protection-firefox-desktop#w\_what-enhanced-tracking-protection-blocks](https://support.mozilla.org/en-US/kb/enhanced-tracking-protection-firefox-desktop#w_what-enhanced-tracking-protection-blocks)

---

<div class="post-metadata">

**Author:** ![BFranklin9](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/bfranklin9/32/194151_2.png) [@BFranklin9](https://community.hubspot.com/u/BFranklin9)\
**Post date:** [March 29, 2022, 11:24am UTC](https://community.hubspot.com/t/embed-code-loads-blank-form/53829/6 "2022-03-29T11:24:17Z")

</div>

Yes I wondered about that and did try switching off Enhanced Tracking Protection but this didn’t seem to have any effect. Perhaps there are other security features blocking it - although it’s odd that it would still work occasionally.

---

<div class="post-metadata">

**Author:** ![Jake\_Lett](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jake_lett/32/45178_2.png) [@Jake\_Lett](https://community.hubspot.com/u/Jake_Lett)\
**Post date:** [March 28, 2022, 9:27am UTC](https://community.hubspot.com/t/embed-code-loads-blank-form/53829/7 "2022-03-28T09:27:07Z")

</div>

Try editing your embed code to include a target div with a unique ID. This will tell the script to load the form in the div. I have had issues loading forms in wordpress sites and the target ID fixed the loading issue. If this doesn’t work, another thing you could try is wrapping the form embed code with a on window load. This will run the code after everything else on your page is done loading.

```auto
window.addEventListener('load', (event) => {
 // paste your form embed code in here
});

```

> <https://gist.github.com/JacobLett/45561dec14ee018f02b1c3144125a634>

---

<div class="post-metadata">

**Author:** ![BFranklin9](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/bfranklin9/32/194151_2.png) [@BFranklin9](https://community.hubspot.com/u/BFranklin9)\
**Post date:** [March 29, 2022, 9:40am UTC](https://community.hubspot.com/t/embed-code-loads-blank-form/53829/8 "2022-03-29T09:40:28Z")

</div>

Thanks for the suggestions [@Jake\_Lett](https://community.hubspot.com/t5/user/viewprofilepage/user-id/72866), but unfortunately neither solved the issue. If it helps, this is only a problem on Firefox - see my other reply.
