IE11 does not escape a concatenated “<” character

霸气de小男生 提交于 2019-12-11 12:44:41

问题


I have a string, say hello <whatever>, how are you?. When I check the "page source", I get proper rendering of that string (with special characters converted).

However, if I try to read that string and put it on a pop-up window message, the message will read hello , how are you?. If I place a space after the < character (i.e.: hello < whatever >, how are you?), the pop-up message displays correctly: hello < whatever >, how are you?.

How can I properly escape the < character so that the entire text gets read properly? &lt; and &064; does not do the trick (remember that they are properly converted anyway).

Summary: any string that has a < special character followed by any alphabetical character without any blank space in between cannot be properly read by IE(11).

Edit: As soon as I posted this question, you can see what I mean by reading the first sentence. It shows as hello , how are you? even though I typed hello < whatever>, how are you? with no space between the < character and whatever.


回答1:


You need to use HTML character encoding:

&lt; for <

&gt; for >

See the W3C's Character Entity Reference Chart for more information.



来源:https://stackoverflow.com/questions/28908379/ie11-does-not-escape-a-concatenated-character

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!