Firefox don't apply encoding after form redirect

Hello, my forms are working but there is an issue with Firefox.

When redirecting, Netlify injects a script tag with data from the submitted form just after <head> causing Firefox to show this error (console):

The character encoding declaration of document was found too late for it to take effect. The encoding declaration needs to be moved to be within the first 1024 bytes of the file.

Which causes encoding issues in my site.

Is there anything that can be done in my end?

Could Netlify inject the (useful) script tag before </head> to prevent such issues?

Thanks for the attention.

Hi @marcosmesser,

Can you tell me which script tag it is that you’re saying we are injecting? We don’t inject a script tag in to your code when you using forms. If you can provide a link and/or screen shots that would be useful.

Hello @futuregerald,

I just tested it, the tag below is added just after opening <head> in the the page listed in the action attribute (I’ve redacted some identifying information, but left the ids):

<script>var FormSubmission = {"title":"test","email":"","name":"test","first_name":"test","last_name":null,"company":null,"summary":"\u003cstrong\u003etest\u003c/strong\u003e test","body":"test","data":{"name":"test","email":"","_subject":"...","message":"test","ip":"...","user_agent":"...","referrer":"..."},"created_at":"2019-07-25T20:11:03.389Z","human_fields":{"Name":"test","Email":"","Subject":"...","Message":"test"},"ordered_human_fields":[{"title":"Name","name":"name","value":"test"},{"title":"Email","name":"email","value":""},{"title":"Subject","name":"_subject","value":""},{"title":"Message","name":"message","value":"test"}],"id":"5d3a0cd76dc9d872e783632d","form_id":"5d38a75e1500b1000794665a","site_url":"...","form_name":"..."};</script>

Thanks @marcosmesser, I wasn’t sure which script injection you were referring to. Can you link me to your site so that I can test this and have a repro case for the request I need to file.

Sorry for the late reply, I had a few days off.

You can try this one:

(I am aware of the accessibility shortcomings.)

But any form with more than 5 input fields might give the same issue.

Thanks @marcosmesser. I got an issue filed. We’ll let you know once we know more. Note that this shouldn’t actually prevent your site from working though.