0

TagCanvasプラグインを使用していて、IE 8ブラウザーでテストしたいのですが、文書化されているように、IE <9用のExoplorerキャンバスを追加しました。キャンバス要素を初期化して、IE8で表示できません。

     <head>
         <script src="excanvas.js" type="text/javascript"></script>
         <script src="jquery-1.7.2.min.js" type="text/javascript"></script>
            <script src="tagcanvas.js" type="text/javascript"></script>
    <script type="text/javascript">

            window.onload = function () {
                try {
                    TagCanvas.Start('myCanvas');
                } catch (e) {
                    // something went wrong, hide the canvas container
                    alert("cannot load");
                    document.getElementById('myCanvasContainer').style.display = 'none';
                }
            };
     </script>
        </head>
<body>
   <div id="myCanvasContainer">
 <canvas width="300" height="300" id="myCanvas">

  <ul>

   <li><a href="#">test</a></li>
   <li><a href="#">test1</a></li>

  </ul>
 </canvas>
</div>
</body>

IE 8でサポートされるcanvas要素の参照が欠落しているかどうかを知ることができますか?

4

1 に答える 1

0

見る:


Modernizrは、JavaScript library that detects which HTML5 and CSS3 features訪問者のブラウザーがサポートするものです。機能のサポートを検出する際に、it allows developers to test for some of the new technologies and then provide fallbacks for browsersそれらをサポートしていません。これはfeature detection and is much more efficient than browser sniffing.

キャンバスを例として再度使用すると、通常、サポートされていない IE8 以下のフォールバックが必要になります。これを行う通常の方法は、HTML 内の FlashCanvas などの JavaScript ポリフィルにリンクすることです。

<script src="http://flashcanvas.net/bin/flashcanvas.js"></script>

The problem with this approach is that all browsers will download this script.
それは不要ですし、should be avoided where possible.

<script>間違いなく条件付きコメントで要素をラップできますが、ファイルをマークアップから完全に除外できる場合は、そうする必要があります。You can do this using Modernizr.load().

Modernizr has YepNope built into it。機能を簡単にテストしてから、ポリフィルを提供できます。

の基本的な使用法により、フィーチャ と を.load() function使用できます 。この例では、 、、および:testask whether it’s true (yep) or false (nope).
Modernizr tests for canvas supportif the feature doesn’t exist, then it loads FlashCanvas


Modernizr.load({
  test: Modernizr.canvas,
  nope: 'http://flashcanvas.net/bin/flashcanvas.js'
});

于 2013-01-22T05:55:09.877 に答える