top of page
Writer's pictureBrent D. Payne

<head> should not include a <noscript> tag with an image

Within the <head> section of an HTML document, a <noscript> tag has been used to specify an image, which is not compliant with web standards.


Why is this important?

The <noscript> tag provides an alternative for users where JavaScript is not enabled or supported in their browsers. However, within the <head> section, only <link>, <style>, and <meta> tags are allowed. Using an <img> tag here is not correct.


Search engine bots, which primarily do not execute JavaScript, could encounter issues parsing the <head> section due to the misplaced <img> tag. This could possibly result in key elements being overlooked, affecting page indexing.


What does the optimization check?

This check will be triggered if a <noscript> tag within the <head> section contains an <img> tag, which is deemed invalid in this context.


Examples that trigger this optimization

An instance where this optimization would activate includes having a <noscript> enclosing an <img> tag located within the <head> portion of the code.


<!doctype html><html lang="en"><head>    <noscript><img src="https://loudinteractive.com/images/image1.gif" /></noscript>    ...</head><body>...</body></html>


How do you resolve this issue?

This issue is categorized as 'Critical' because it could severely impair a website's search engine performance. Addressing Critical problems promptly is highly advised.


Determine the exact role of the <noscript> tag. Consider relocating the <noscript> to the <body>, where the use of an <img> tag is permissible.


Ensure that all inappropriate tags, including image tags, are eliminated from any <noscript> tag that remains in the <head> section.


Refer to the guidance by Google on this subject:

"We strongly advise against using these invalid tags within the <head>, but if unavoidable, place them after the tags you want Google to process. Upon detecting an invalid tag, Google presumes the end of the <head> section and will not read further."


Even code for well-known services such as Facebook can cause this issue. The code for Facebook's tracking pixel includes both <script> and <noscript> tags, with the latter being problematic if it contains an image.


To address issues caused by the Facebook tracking pixel, consider the following:

  1. Relocate the <noscript> portion to the bottom of the <head> as per Google's advice, ensuring it doesn't interfere with their parsing of critical indexing elements.

  2. Place the <noscript> tag within the <body>. According to user reports on Stack Overflow, this should operate correctly.

  3. Remove the <noscript> section entirely, acknowledging that only a tiny fraction of users without JavaScript enabled might not be captured in conversion tracking data.

Further Reading

8 views
bottom of page