Why does Google Visualization cause HTML1504 Unexpected end tag errors?

Can anyone explain why I get a HTML1504: Unexpected end tag warning when using the Google Visualization API to display a chart?

I have been debugging a website where the chart displayed fine in Firefox, but didn't show any data in IE11. I eventually fixed the problem (an invalid date format that IE11 handled differently to Firefox), but wasted a lot of time trying to track down the above error.

My code is based on the example code at https://developers.google.com/chart/interactive/docs/quick_start, which gives the same message. Nothing untoward shows up in either JSLint or the W3C HTML Validator.

The warning goes away if I comment out the line google.load('visualization', '1.0', {'packages':['corechart']}); but this obviously stops the chart working too. Changing the IE11 compatibility settings did not appear to have any effect.

The error is visible in the IE11 Developer Console, but nothing equivalent comes up in the Console, Browser Console or Firebug console in Firefox. IE11 reports the error as being triggered by the </script> tag at the end of my chart code (this is inline javascript, rather than a separate file). Removing the </script> tag causes HTML errors (as expected!)

I am intrigued that a function call in Javascript should be able to cause an error in the surrounding HTML. Is the warning message significant? Can it be avoided?



I had the same issue on MS Edge + Win 10. No warnings with the new loader:

<!DOCTYPE html><html><head>
  <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
  <script type="text/javascript">
    google.charts.load('current', {'packages':['corechart']});

Google charts that are loaded with jsapi, are no longer updated unless absolutely necessary.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.