# Gravity Forms Injecting Inline Javascript Code in Header | Fix or Input Needed

**URL:** <https://community.gravityforms.com/t/gravity-forms-injecting-inline-javascript-code-in-header-fix-or-input-needed/12517>\
**Category:** Get Help\
**Tags:** javascript, headers, delay, defer\
**Created:** [April 28, 2022, 6:35pm UTC](https://community.gravityforms.com/t/gravity-forms-injecting-inline-javascript-code-in-header-fix-or-input-needed/12517 "2022-04-28T18:35:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AeroStar](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/aerostar/32/15243_2.png) [@AeroStar](https://community.gravityforms.com/u/AeroStar)\
**Post date:** [April 28, 2022, 6:35pm UTC](https://community.gravityforms.com/t/gravity-forms-injecting-inline-javascript-code-in-header-fix-or-input-needed/12517/1 "2022-04-28T18:35:03Z")

</div>

**Good Day!**

On every page where we use Gravity Forms, we noticed Gravity Forms is placing an inline Javascript code in the header of our affected pages (ahead of other, more important code).

**Details:**

> **[Screenshot](https://prnt.sc/PB3GER_3xpIe)**
>
> Captured with Lightshot

**Code Excerpt:**

```auto
<script type="text/javascript">
var gform;gform||(document.addEventListener("gform_main_scripts_loaded",function(){gform.scriptsLoaded=!0}),window.addEventListener("DOMContentLoaded",function(){gform.domLoaded=!0}),gform={domLoaded:!1,scriptsLoaded:!1,initializeOnLoaded:function(o){gform.domLoaded&&gform.scriptsLoaded?o():!gform.domLoaded&&gform.scriptsLoaded?window.addEventListener("DOMContentLoaded",o):document.addEventListener("gform_main_scripts_loaded",o)},hooks:{action:{},filter:{}},addAction:function(o,n,r,t){gform.addHook("action",o,n,r,t)},addFilter:function(o,n,r,t){gform.addHook("filter",o,n,r,t)},doAction:function(o){gform.doHook("action",o,arguments)},applyFilters:function(o){return gform.doHook("filter",o,arguments)},removeAction:function(o,n){gform.removeHook("action",o,n)},removeFilter:function(o,n,r){gform.removeHook("filter",o,n,r)},addHook:function(o,n,r,t,i){null==gform.hooks[o][n]&&(gform.hooks[o][n]=[]);var e=gform.hooks[o][n];null==i&&(i=n+"_"+e.length),gform.hooks[o][n].push({tag:i,callable:r,priority:t=null==t?10:t})},doHook:function(n,o,r){var t;if(r=Array.prototype.slice.call(r,1),null!=gform.hooks[n][o]&&((o=gform.hooks[n][o]).sort(function(o,n){return o.priority-n.priority}),o.forEach(function(o){"function"!=typeof(t=o.callable)&&(t=window[t]),"action"==n?t.apply(null,r):r[0]=t.apply(null,r)})),"filter"==n)return r[0]},removeHook:function(o,n,t,i){var r;null!=gform.hooks[o][n]&&(r=(r=gform.hooks[o][n]).filter(function(o,n,r){return!!(null!=i&&i!=o.tag||null!=t&&t!=o.priority)}),gform.hooks[o][n]=r)}});
</script>

```

**Questions:**

(1) What is the purpose of this inline JS code and why is it loaded in the header? (I’m not a coder nor a developer)

(2) How can I delay, defer, or move this code to the the footer of our website.

(3) Is their a specific Gravity Forms file (i.e., file name) that contains and injects this code? Once known, it will be easier to defer or delay the file.

(4) Will delaying or deferring this code (or associated files) impact the performance and display of our Gravity Forms?

Thank you!

Jonathan

---

<div class="post-metadata">

**Author:** ![user5ffd00cd1f673661](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/user5ffd00cd1f673661/32/5247_2.png) [@user5ffd00cd1f673661](https://community.gravityforms.com/u/user5ffd00cd1f673661)\
**Post date:** [May 12, 2022, 7:52pm UTC](https://community.gravityforms.com/t/gravity-forms-injecting-inline-javascript-code-in-header-fix-or-input-needed/12517/2 "2022-05-12T19:52:23Z")

</div>

I went to Settings \> disable/turned off Output Default CSS  
that seems to fix it

---

<div class="post-metadata">

**Author:** ![AeroStar](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/aerostar/32/15243_2.png) [@AeroStar](https://community.gravityforms.com/u/AeroStar)\
**Post date:** [May 16, 2022, 3:11pm UTC](https://community.gravityforms.com/t/gravity-forms-injecting-inline-javascript-code-in-header-fix-or-input-needed/12517/3 "2022-05-16T15:11:58Z")

</div>

Hi Wenni,

Thank you for the tip!

We did that earlier (prior to posting this topic), but the styling of our gravity forms broke. According to the setting description, [the setting should be disabled if you plan to use custom css in a child theme](https://prnt.sc/xsfwMxziz9_5).

Questions:

(1) Are you using a child theme? We aren’t.

(2) Are you using custom CSS for your forms? We are.

Thank you!

Jonathan

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/gravityforms1/original/2X/f/fef63f0599c45e0218c30d9f5d7ca8bff9b00189.png) [@system](https://community.gravityforms.com/u/system)\
**Post date:** [June 15, 2022, 3:12pm UTC](https://community.gravityforms.com/t/gravity-forms-injecting-inline-javascript-code-in-header-fix-or-input-needed/12517/4 "2022-06-15T15:12:12Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
