Using Flot with Bootstrap: IE8 incompatibility?

一个人想着一个人 提交于 2019-12-05 10:33:34

html5shim and and excanvas somewhat do the same thing I'm guessing? excanvas emulates html5 canvas elements and html5shim does some other magic that I'm not too clear on. In short, you'll want to tell html5shim to knock it off when it comes to IE<9 and canvas elements. I dug around in the source a bit and found this information.

The html5 object is exposed so that more elements can be shived and existing shiving can be detected on iframes.
options can be changed before the script is included html5 = { 'elements': 'mark section', 'shivCSS': false, 'shivMethods': false };

Soon after it lists all the elements that will be "shiv"d, so I came up with this as a solution:

<!--[if lt IE 9]>
  <script type="text/javascript">
    var html5 = { 'elements': 'abbr article aside audio bdi data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video' };
  </script>
  <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

The giant list in elements I took out of the source as well, only removing canvas.

Apart from that, I used all of your example and it seemed to work fine.

I've also run into a problem with bootstrap and flot in ie8, but couldn't entirely identify with the OP's question. Even though what resolved the problem for me is about the same as Ryley's answer, it took me an hour to understand what I needed to do to make it work.

Simple Solution:

  1. Download excanvas.js (If it's not in your flot package.)
  2. Add conditional comment before I load all other javascript files in the head tag: <!--[if IE 8]> <script src="@Url.Content("~/Scripts/canvas/excanvas.min.js")" type="text/javascript"></script> <[endif]-->

Quite simple, but: I got on this track by debugging javascript in IE, with "break on error" activated. That got me the following error msg: 'window.G_vmlCanvasManager' is null or not an object . Googling that lead me to excanvas.js. And pronto, flot.js suddenly worked. I don't know if this has anything to do with HTML5shim, but it works... and is simpler than the answer Ryley proposes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!