Let IE8 support HTML5 and canvas functions! __html

Source: Internet
Author: User

Microsoft's IE9 support HTML5, but because I do not support the XP system, I still can not use it for the time being.

Even if you can use, at this stage if the development of HTML5 page, and consider compatibility issues, I am afraid also have to let their own interface support Ie6-8 bar.

First, you need to have IE support HTML5 tags. This is simple, any search on the internet can be found. Download a html5.js and copy it to your directory.

Now write a simple code that has the function of placing a canvas on the page and drawing a red circle.

 1 <! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" > 2 <HTML> 3 <HEAD> 4 <TITLE> IE8 support h 
TML5+CSS3 </TITLE> 5 

Paragraph code, in the surf and Firefox, can be used. But in IE8, not only nothing, the following status bar will also show yellow small exclamation mark, point open, tell us, CTX did not take to canvas.

The first step, we add to the support of HTML5.

<!--[if ie]>
    <script src= "/public/html5.js" type= "Text/javascript" ></script>
<![ Endif]-->

Now look again, there will be a dark frame, that IE8 already know the canvas tag. But the red circle still does not come out, the following status bar still prompts US JS did not take to canvas. This means that IE still only know the canvas is a legitimate label, as to how to deal with it, I am sorry, I will not.

The second step, coupled with support for canvas.

Download Excanvas_r3.zip, unpack, copy excanvas.compiled.js into your directory, and reference it. Now look, ha, a red circle appears. JS works.

<!--[if ie]>
    <script type= "Text/javascript" src= "/public/html5.js" ></script>
    <script Type= "Text/javascript" src= "/public/excanvas.compiled.js" ></script>
<![ Endif]-->


If you are careful enough, you will notice that there are two lines in the style sheet:

    border-radius:20px;
    box-shadow:0 0 40px #222;

This is the style of CSS3 oh. Border-radius that we want the black box around should be rounded corner is right, but now four Leng eight inserted; Box-shadow there's shadow.

Here is the third step, let IE support CSS3. At the end of the CV selector, add a word

Behavior:url (/PUBLIC/IE-CSS3.HTC);
#cv {
    width:600px; height:400px;
    Background: #000;
    border-radius:20px;
    padding:20px;
    margin:20px Auto;
    box-shadow:0 0 40px #222;
    Behavior:url (/PUBLIC/IE-CSS3.HTC);
}

Among them, ie-css3.htc to http://fetchak.com/ie-css3/download, concrete it can support how many CSS3 characteristics, the website said very clearly, I don't waste breath.

Finally, after we download three files, add three words, see the effect. Hehe

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.