How can I fix the W3C validation errors related to the noscript tag and the Facebook pixel code in the head tag of my Webflow website?
TL;DR
- Move the Facebook Pixel’s <noscript> image tag from the <head> to the footer custom code area in Webflow.
- Keep the main script in the <head>, republish the site, and revalidate using the W3C Validator to eliminate errors.
W3C validation errors related to the <noscript> tag and Facebook Pixel often occur because of improper placement or disallowed HTML elements in the <head> of your Webflow project.
1. Understand the Validation Error Source
- W3C HTML specifications do not allow the
<noscript>tag inside the<head>if it contains anything other than<link>,<style>, or text nodes. - Facebook Pixel recommends inserting a
<noscript>fallback image tag, but Webflow allows custom code in the<head>, where such tags may trigger validation errors.
2. Move the <noscript> Tag to the Body
- Go to Project Settings in Webflow.
- Click on the Custom Code tab.
- Scroll to the Footer Code area (before
</body>). - Move the entire
<noscript>block (including the<img>tag Facebook provides) from the head section to this footer section. - This avoids placing disallowed tags inside
<head>, aligning your site with W3C specs.
3. Adjust the Facebook Pixel Code
- The main Facebook Pixel script can remain in the
<head>, as it uses a standard<script>tag that is allowed. - Only the
<noscript><img></noscript>part needs to move to avoid validation errors. - Make sure the moved
<noscript>snippet stays intact—don't alter the actual Facebook tracking URL or image properties likestyleorheight.
4. Re-Publish and Re-Validate
- Click Publish in Webflow and wait for the changes to go live.
- Use the W3C Validator to re-check your updated site.
- The validation errors related to the
<noscript>tag should now be resolved.
Summary
Move the <noscript> tag containing the pixel tracking image from the <head> to the footer custom code area in Webflow. This satisfies W3C HTML validation without affecting Facebook Pixel functionality.