title: How to prevent & conversion to &amp; when using JavaScript? (browser specifc)
body: <p>I have a problem concerning string output on HTML page when using Javascript and ASP. Logic of page generation goes like this:  </p>
  
  <ol>
  <li><p>We use asp page to generate HTML code using <code>Response.Write()</code>. If string contains numeric character reference (for example <code>&amp;#1057;</code>) it would show on the user's side just fine as a character.</p></li>
  <li><p>After that we add <code>OnLoad</code> event, which calls for a Javascript function. All this happens inside <code>&lt;body&gt;&lt;\body&gt;</code> tags. Source for JavaScript added inside <code>&lt;script&gt;&lt;/script&gt;</code> tags. The function only adds <code>document.href</code>, which contains reference to the same asp page.  </p></li>
  <li><p>The asp logic loads again and adds some text to the page using <code>Response.BinaryWrite()</code> (Response.Write can be used all the same) All character references are shown as codes:<code>&amp;#1057;</code>. Obviously all '&amp;' symbols become <code>&amp;amp;</code>(asp automatic conversion), browser decodes it as &amp; and we can only see a code <code>&amp;#1057;</code> and not the symbol '&#1057;'. </p></li>
  </ol>
  
  <p>As far as I know such behaviour can be caused by <code>&lt;script&gt;</code> tags, as a precaution against xss attacks. In the end I want to stop encoding '&amp;' as <code>&amp;amp;</code>.  </p>
  
  <p>However here is the most important part:  </p>
  
  <p>If I add header with "Content-Type" "text\html", IE (any version) starts encoding NCR symbols in a correct way. But Firefox, Chrome and Safari do not change behavior and keep encoding &amp; as <code>&amp;amp;</code>. I can see several questions on Stack Overflow which looks like mine, yet the situation is not exactly the same (My strings are not inserted directly by JavaScript, so I cannot manipulate output string and change <code>&amp;amp;</code> to &amp;, also my strings have correct symbols in the first place, they get changed by asp or by browser). Is there any elegant way to force Firefox or Chrome to decode page as IE? Maybe some settings or attributes in HTML tags? This problem looks like it depends on a browser to me, am I right?</p>