3 solutions to make your website support old versions of IE6, 7, 8, and 9 browsers

3 solutions to make your website support old versions of IE6, 7, 8, and 9 browsers
Although Microsoft has done a lot of research and development on the browser later, the fact is that the modern IE browser is often behind the webkit-based browsers and Firefox. We also need to adapt to earlier versions of IE. The following tips will make your website faster and even run magically better on Microsoft’s flagship browser!

htmlshiv.js

Remy's HTML5shiv uses JavaScript to create HTML5 elements (such as main, header, footer, etc.). Elements created through JavaScript are styleable to a certain extent. We can spend a lot of time thinking about how this works, but who cares? This strategy is still a must-have on all product websites.

Copy code
The code is as follows:

<!--[if lt IE 9]>
<script src="dist/html5shiv.js"></script>
<![endif]-->


selectivizr.js

Selectivizr.js is an incredible resource for polyfilling unsupported CSS selectors and properties, including the important last-child. In a recent redesign, I embedded selectivizr and didn't miss any details on older IE browsers. Here is my implementation code:

Copy code
The code is as follows:

<!--[if lte IE 8]><script src="js/libs/selectivizr.js"></script><![endif]-->

An absolute must for modern projects. Only loaded in old IE

<html> Conditional Comments

You must have seen the most tacky situation below. But ugly or not, this code actually works exactly as expected:

Copy code
The code is as follows:

<!DOCTYPE html>
<!--[if lt IE 7 ]> <html class="ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]> <html class="ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]> <html class="ie8" lang="en"> <![endif]-->
<!--[if IE 9 ]> <html class="ie9" lang="en"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en"> <!--<![endif]-->


This code snippet doesn't require or wait for JavaScript, and doesn't require a heavyweight JavaScript library. The styles class you define takes effect immediately, without any splash screen.

Although Internet Explorer is catching up with its competitors, the fact is that the older IE browser is still relatively popular, especially in developing countries. The good news is that these resources work great on all modern browsers and don’t cost much!

<<:  A detailed introduction to Linux system operation levels

>>:  About the problem of vertical centering of img and span in div

Recommend

How to limit the number of concurrent connection requests in nginx

Introduction The module that limits the number of...

Detailed explanation of Vue login and logout

Table of contents Login business process Login fu...

A brief analysis of how to upgrade PHP 5.4 to 5.6 in CentOS 7

1. Check the PHP version after entering the termi...

Summary of Binlog usage of MySQL database (must read)

I won't go into details about how important b...

MySQL 5.7.15 installation and configuration method graphic tutorial (windows)

Because I need to install MySQL, I record the ins...

MySQL/MariaDB Root Password Reset Tutorial

Preface Forgotten passwords are a problem we ofte...

Vue integrates PDF.js to implement PDF preview and add watermark steps

Table of contents Achieve results Available plugi...

HTML+CSS implementation code for rounded rectangle

I was bored and suddenly thought of the implementa...

Javascript destructuring assignment details

Table of contents 1. Array deconstruction 2. Obje...

How to backup MySQL regularly and upload it to Qiniu

In most application scenarios, we need to back up...

A screenshot demo based on canvas in html

Written at the beginning I remember seeing a shar...

Alibaba Cloud Server Tomcat cannot be accessed

Table of contents 1. Introduction 2. Solution 2.1...

Beginners understand MySQL deadlock problem from source code

After many difficult single-step debugging late a...

Solve the abnormal error when building vue environment with webpack

Table of contents First, configure package.json T...