Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you are using XHTML, you would be able to use entity references (<code>&amp;lt;</code>, <code>&amp;gt;</code>, <code>&amp;amp;</code>) to escape any string you want within <code>&lt;script&gt;</code>. You would <em>not</em> want to use a <code>&lt;![CDATA[...]]&gt;</code> section, because the sequence "<code>]]&gt;</code>" can't be expressed within a CDATA section, and you would have to change the script to express <code>]]&gt;</code>.</p> <p>But you're probably not using XHTML. If you're using regular HTML, the <code>&lt;script&gt;</code> tag acts somewhat like a CDATA section in XML, except that it has even more pitfalls. It ends with <code>&lt;/script&gt;</code>. There are also arcane rules to allow <code>&lt;!-- document.write("&lt;script&gt;...&lt;/script&gt;") --&gt;</code> (the comments and <code>&lt;script&gt;</code> opening tag must both be present for <code>&lt;/script&gt;</code> to be passed through). The compromise that the HTML5 editors adopted for future browsers is described in <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#script-data-state" rel="noreferrer">HTML 5 tokenization</a> and <a href="http://wiki.whatwg.org/wiki/CDATA_Escapes" rel="noreferrer">CDATA Escapes</a></p> <p>I think the takeaway is that you must prevent <code>&lt;/script&gt;</code> from occurring in your JSON, and to be safe you should also avoid <code>&lt;script&gt;</code>, <code>&lt;!--</code>, and <code>--&gt;</code> to prevent runaway comments or script tags. I think it's easiest just to replace <code>&lt;</code> with <code>\u003c</code> and <code>--&gt;</code> with <code>--\&gt;</code> </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload