What is CDATA in HTML?

HTMLWeb DevelopmentFront End Technology

The CDATA Section interface is used within XML for including extended portions of text. This text is unescaped text, like < and & symbols. These symbols do not want to escape.

It is used like this:

<![CDATA[ ... ]]>

Here’s an example:

<p>The following is CDATA <![CDATA[ < > & ]]> with symbols that do not need escaping.

To avoid parsing <> &, it gets added in <script>…</script>. It is not needed in HTML. Let’s see how CDATA gets added in <script> tags:

<script type="text/javascript">

Note: CDATA is now deprecated. Do not use.

Published on 02-Jan-2018 09:21:37