Strange extra characters in rendered html on IE 8

I have an ASP.Net MVC site where I want to display some custom HTML 5 canvases. I get a strange problem with a server serving extra characters that are not in the source code.

To use HTML 5 canvas in IE 8, you must add the following tag to the html header:

<!--[if IE]><script src="../../Scripts/excanvas.js"></script><![endif]-->

For some reason, this is served as:

<!--[if IE]>IE]><script src="../../Scripts/excanvas.js"></scr<![endif]-->

Of course, duff markup causes the excanvas script to not load IE. I can not understand why the line is distorted. I have the following doctype type, which is documented at http://www.w3schools.com/html5/tag_doctype.asp :

<!DOCTYPE html>

I am not familiar with using HTML 5 or the new doctype type, so I am suspicious of it. I also host Apache with Mono, so maybe this is what distorts the line.

This page is located at: http://openancestry.org/FamilyTree/Simpsons

Has anyone seen this before or knows why I can't use the if if syntax?

UPDATE: Well, I'm sure it is either Mono or Apache that distort HTML, so I used the workaround below, which adds the compatibility meta tag for IE8 and includes excanvas for any IE that precedes IE9. I will still be grateful for any answers to the question why HTML is being garbled.

<% if (Request.Browser.Browser.Contains("IE") && float.Parse(Request.Browser.Version) < 9) { %>
<% if (float.Parse(Request.Browser.Version) > 7) { %>
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<% } %>
<script type="text/javascript" src="../../Scripts/excanvas.js"></script>
<% } %>
+3
source share
1

, , type="text/javascript".

, ASP.NET Mono . Mono ( ).

Mono 2.10 Mac .

0

Source: https://habr.com/ru/post/1772381/


All Articles