# hsform embed js loading twice?

**URL:** <https://community.hubspot.com/t/hsform-embed-js-loading-twice/85486>\
**Category:** Lead Capture Tools\
**Tags:** marketing\
**Created:** [July 17, 2023, 6:17pm UTC](https://community.hubspot.com/t/hsform-embed-js-loading-twice/85486 "2023-07-17T18:17:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmcknight](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dmcknight/32/84489_2.png) [@dmcknight](https://community.hubspot.com/u/dmcknight)\
**Post date:** [July 17, 2023, 6:17pm UTC](https://community.hubspot.com/t/hsform-embed-js-loading-twice/85486/1 "2023-07-17T18:17:54Z")

</div>

I’m working on improving my lighthouse score and noticed that lighthouse is reporting the embed script loading twice on my page, even though in the code, it is there only once. Is there another script that is loading it, or is it showing twice for some other reason?

 ![dmcknight_0-1689617735951.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/2/23a1c2b67e14704cfd299c2a8bca01f71c5d7e90.png)

---

<div class="post-metadata">

**Author:** ![PamCotton](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/pamcotton/32/47916_2.png) [@PamCotton](https://community.hubspot.com/u/PamCotton)\
**Post date:** [July 18, 2023, 3:28pm UTC](https://community.hubspot.com/t/hsform-embed-js-loading-twice/85486/2 "2023-07-18T15:28:07Z")

</div>

Hello @dmcknight how are you? Thank you for sharing this screenshot.

Currently looks like this is working as designed because the second script injection is actually inside an iframe. When embedding a HubSpot form externally as framed, the {{ **v2.js** }}script is injected into the iframe because there is no communication between the iframe and the parent page. The iframe has its own window, and so it must have its own instance of the script available there to enable the form to behave as expected.

I hope this information helps.

Pam

---

<div class="post-metadata">

**Author:** ![dmcknight](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dmcknight/32/84489_2.png) [@dmcknight](https://community.hubspot.com/u/dmcknight)\
**Post date:** [July 18, 2023, 3:30pm UTC](https://community.hubspot.com/t/hsform-embed-js-loading-twice/85486/3 "2023-07-18T15:30:15Z")

</div>

Tjanks Pam. Is there a more optimal way to embed this form, as the lighthouse report is showing it as the single largest factor affecting the page score. For example, would it be better to use the iframe code instead of the js injection?

---

<div class="post-metadata">

**Author:** ![MSmart1](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@MSmart1](https://community.hubspot.com/u/MSmart1)\
**Post date:** [November 6, 2023, 10:34am UTC](https://community.hubspot.com/t/hsform-embed-js-loading-twice/85486/4 "2023-11-06T10:34:28Z")

</div>

I’m finding exactly the same issue, so much code is not needed and then we get two h2 form javascripts loaded with all the additional js. The V2 JS is the main issue slowing down the website which isn’t great at all for page loading and Google lighthouse.
