Is it possible to use CDATA inside
 tag

前端 未结 2 1167
北恋
北恋 2021-01-18 00:49

I want to display an exception trace in the HTML page.

One way to do this is to escape HTML special characters in the exception trace and dump it inside the &l

2条回答
  •  [愿得一人]
    2021-01-18 01:26

    Yes, but only in XHTML (in theory, I think it should work in HTML, but web browsers deal in tag soup not HTML 4.x) and not if you serve the document as text/html (which you have to if you want it to work with Internet Explorer).

    As far as efficiency goes, replacing <, & and > with their respective entities is a trivial operation in any programming language (or text editor with a Find & Replace facility), which doesn't add a significant number of bytes except in conditions of extremely limited bandwidth.

提交回复
热议问题