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

CSS Sticky Footer Several Implementations

What is "Sticky Footer" The so-called &...

HTML discount price calculation implementation principle and script code

Copy code The code is as follows: <!DOCTYPE HT...

Detailed explanation of javascript knowledge points

Table of contents 1. Basic Introduction to JavaSc...

Oracle VM VirtualBox installation of CentOS7 operating system tutorial diagram

Table of contents Installation Steps Environment ...

Common parameters of IE web page pop-up windows can be set by yourself

The pop-up has nothing to do with whether your cur...

How to set the border of a web page table

<br />Previously, we learned how to set cell...

Some references about colors in HTML

In HTML, colors are represented in two ways. One i...

Vue+axios sample code for uploading pictures and recognizing faces

Table of contents Axios Request Qs processing dat...

Button is stretched on both sides in IE

When you write buttons (input, button), you will f...

MySQL 5.7.20 free installation version configuration method graphic tutorial

I have seen many relevant tutorials on the Intern...

Analysis of MySQL data backup and recovery implementation methods

This article uses examples to describe how to bac...

More Ways to Use Angle Brackets in Bash

Preface In this article, we will continue to expl...

js to call the network camera and handle common errors

Recently, due to business reasons, I need to acce...

JavaScript closure details

Table of contents 1. What is a closure? 2. The ro...