IE9 and TEXTAREA newlines

2019-03-04 02:17发布

问题:

We display a piece of signed XML in a TEXTAREA. The signing takes into account the whitespace, so it is critical that this is maintained.

The user then copies and pastes this into an application that validates the XML... we've not had a problem with this until now... IE9 is rending the text slightly differently.

When I copy it into a HEX editor, I can see that IE9 is rendering newlines as 0xA... put it into compatibility mode (or use IE6,7,8, Chrome, Firefox etc.) and it gets rendered as 0xD,0xA

I guess this won't effect most people, as it looks ok... but for us it is a royal PITA!!!

Anyone come across this, and better have a fix :)

Thanks!!!

回答1:

Not sure if this is really a fix (and I do wonder if this is a bug in IE9?)

Anyhow, I ended up putting IE9 into IE7 emulation mode for the page in question:

http://msdn.microsoft.com/en-us/library/cc288325(v=vs.85).aspx

  <!-- Mimic Internet Explorer 7 -->
  <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" >

It works, but now, of course I don't have the IE9 features on this page.