Expand my Community achievements bar.

Adobe Target: Why DOCTYPE is required on the webpage

Avatar

Employee Advisor

Missing DOCTYPE declaration on a webpage often disables the Adobe Target library, without which the personalization is not possible on your site pages.

Target library at.js requires the HTML5 doctype. The syntax is: <!DOCTYPE html>.

HTML DOCTYPE must be the very first thing in your HTML document before the HTML tags. It acts as an instruction to the web browser about the version of the markup language in which the page is written.

Initially, the Doctype declaration was used in HTML when it was defined as a language based on SGML and later XML. Since the presence of that declaration was in general a signal that the document author followed the standard practices and then this declaration was used in HTML5 to distinguish between standards-compliant parsing mode and a so-called quirk parsing mode.

The HTML5 doctype ensures that the page loads in standard mode. Some JavaScript APIs gets disabled when a site page loads in quirks mode. Target library also depends on some JS APIs which gets disabled with quirks mode.

           Whether the document is parsed in standard mode or quirks mode, or simply parsing the same way across HTML5 processors, the doctype is a critical component of a quality HTML document.

In the past, the declaration was passive – ignored by the browser until you’d validate the document where the validator would use the DOCTYPE declaration to compare your document with the declared Document Type Definition (DTD). But with the technology known as DOCTYPE switching has made using the correct DOCTYPE declaration not only important, but imperative. On finding a correct DOCTYPE in the document, browsers allow page to render in standard mode.

The idea here is to -

  • understand how important is DOCTYPE Declaration on a webpage,
  • what makes up a correct declaration, and
  • most importantly, including the correct DOCTYPE declaration in a page is required to enable Target libraries effectively.

Hope this helps.

Thanks,

Khushboo Kalia

0 Replies