noscript alternative in XHTML?

后端 未结 2 1319
广开言路
广开言路 2020-12-20 22:59

In HTML I could do:


Is ther

2条回答
  •  臣服心动
    2020-12-20 23:54

    The current chosen answer is misleading.

    W3C says:

    The noscript element is only effective in the HTML syntax, it has no effect in the XHTML syntax. This is because the way it works is by essentially "turning off" the parser when scripts are enabled, so that the contents of the element are treated as pure text and not as real elements. XML does not define a mechanism by which to do this.

    Now, the little dirty secret about XHTML is that browsers are not treating XHTML in XML unless the documented is served in application/xhtml+xml as the MIME type.

    In case your page is served as proper XHTML, then a solution might be changing the doctype of the page to HTML5 and MIME type to text/html.

提交回复
热议问题