-->

Internet Explorer markup errors when using Google

2019-04-16 02:03发布

问题:

I'm using Google Feed API to display an RSS-feed on a customers SharePoint intranet, which works perfect with Chrome, Firefox and other modern browsers. The exception is of course Internet Explorer, both 10 and 11 which we've committed to support. The feed is shown only some times, but the errors thrown in the developer console of IE10 or IE11 are always thrown, even when the feed is displayed.

I reference the jsapi source as Google suggests, with a regular <script> tag like

<script type="text/javascript" src="http://www.google.com/jsapi"></script>

The weird behaviour from Internet Explorer occurs in two different ways.

If I load the feeds here like this

<script type="text/javascript">   
    //lots of other stuff to be run...
    google.load("feeds", "1");
</script>

in the end of the document, I get the error

HTML1512: Unmatched end tag.

If I instead initialize it in a <script> block of it's own, I get the following error thrown sometimes, and some other times, I get the first one.

HTML1504: Unexpected end tag.

The behaviour is highly irregular and there appears to be no pattern when it works and when it doesn't.

The obvious answer to this question is that IE10 and IE11 is correct, and that Chrome and other browsers ignore the flaws in my markup, but I've run it through validators and checked it tag by tag and there are no missing opening or end tags. I've also commented out the google.load part, and the errors disappear.

I found a similar but unanswered topic here on SO that is related to this issue.

Why does Google Visualization cause HTML1504 Unexpected end tag errors?

Has anyone else experienced this? What causes this and how can it be solved?