Is there a way to use Canvas in IE7 or IE8?

2019-02-17 11:15发布

问题:

Is there any workaround to use "Canvas" tag in IE7 and IE8 ? Pls let me know.

<input type="text" id="textSign" value="Sign" />
<input type="button" onclick="javascript:return changeSign();" value="changeSign" />
<canvas id="e" width="150" height="100"></canvas>
<script type="text/javascript">
var textSign = document.getElementById("textSign").value;
      function changeSign() {
             textSign = document.getElementById("textSign").value;
                    var canvas = document.getElementById("e");
                    var context = canvas.getContext("2d");
                    context.fillStyle = "#4c4c4c";
                    context.font = "30px Giddyup Std";
                    context.fillText (textSign , 20, 50);
                }
            </script>

回答1:

Yes, there is a project to simulate the canvas API on older versions of IE (7 and 8).

You can find it here, simply include the JavaScript file and go on as canvas was supported.

Please note that is another layer of JavaScript code on the top of IE (and it's not famous to be very fast to parse JavaScript...)



回答2:

Yes there is : https://developers.google.com/chrome/chrome-frame/

But as with any modern web technology, you'll have to make extensive tests while developping. And depending on your deployement location, you may be forbidden to use that (sysadmins still imposing IE7 may have strange requirements).



回答3:

No. Canvas element is supported only in IE9.