If determines the type of IE browser

Source: Internet
Author: User

Sometimes if judgment is required.

In ie CSS hack (more methods), if IE is often used to determine the browser type to solve the compatibility problem of CSS and even Js, before that, you may know that if IE is used to solve CSS compatibility issues. In fact, if IE is not only used for CSS hack. We can even use if IE for JS processing in front-end development, see the followingCode:

Reference <! -[If IE 5]> <SCRIPT> document. Write ("only ie5.0 and ie5.5 can recognize"); </SCRIPT> <! [Endif]->

<! -[If gte ie 5.0]> <SCRIPT> document. Write ("Both ie5.0 and ie5.0 can be identified"); </SCRIPT> <! [Endif]->

<! -[If IE 6]> <SCRIPT> document. Write ("only IE6 identifiable"); </SCRIPT> <! [Endif]->

<! -[If lt IE 6]> <SCRIPT> document. Write ("recognizable for versions earlier than IE6"); </SCRIPT> <! [Endif]->

<! -[If gte ie 6]> <SCRIPT> document. Write ("recognizable IE6 or later versions); </SCRIPT> <! [Endif]->

<! -[If IE 7]> <SCRIPT> document. Write ("only IE7 identifiable"); </SCRIPT> <! [Endif]->

<! -[If lt IE 7]> <SCRIPT> document. Write ("recognizable versions earlier than IE7"); </SCRIPT> <! [Endif]->

<! -[If gte ie 7]> <SCRIPT> document. Write ("recognizable IE7 and IE7 versions); </SCRIPT> <! [Endif]->

The following is a detailed explanation of if IE:

LTE: Short for less than or equal to, that is, less than or equal.

LT: Short for less than, that is, less.

GTE: Short for greater than or equal to, that is, greater than or equal.

GT: Short for greater than, that is, greater.

! : It means not equal to, which is the same as the non-equal identifier in JavaScript.

Of course, we can also use if IE annotations to introduce JS files and CSS hack (more methods) files, as shown in the following code:

<! -[If lte ie 6]>
<! -If the iebrowser is smaller than or equal to 6, use the ie6.css style sheet.->
<LINK rel = "stylesheet" type = "text/CSS" href = "http://www.js8.in/ie6.css"/>
<! [Endif]->




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.