Home > Web Front-end > Front-end Q&A > Is ie6 compatible with es6?

Is ie6 compatible with es6?

青灯夜游
Release: 2023-01-16 17:59:36
Original
2273 people have browsed it

ie6 is not compatible with es6. IE6 does not support recognizing ES6 syntax and will report an error. Solution: 1. Introduce the babel-browser.min.js file so that you can use ES2015 for encoding; 2. Introduce the browser-polyfill.js file to solve the problem of incompatibility between arrow functions or promises or async and awite; 3. Add the "type="text/babel"" attribute to the script tag.

Is ie6 compatible with es6?

The operating environment of this tutorial: Windows 7 system, ECMAScript version 6, Dell G3 computer.

IE6 does not support ES6 syntax, so when using IE, the ES6 syntax is not recognized and an error is reported.

Browser versions that support ES6 (summary table)

12-1415-18, 79-87Firefox2-56-5354 -86##ChromeSafariOpera##iOS Safari7-9.310-13.7, 14.2##Opera Mini2.1-4.381##Opera Mobile12-12.159# #87UC Browser for Android##12.125-13.010.4Solution for IE not supporting ES6We all know that Babel is used to deal with IE incompatibility issues, but Babel needs to be used with webpack and has a lot of configurations. Things, this is relatively simple, there are a lot of tutorials on the Internet.
Browser Unsupported versions Partially supported versions Supported versions
IE 6-10 11
##Edge
4-20 21-50 51-90
3.1-7 7.1-9.1 10-13.1, 14, TP
10-12.1 15-37 38-72
3.2-6.1
all

##Android Browser
4.4-4.4.4

Chrome for Android

Firefox for Android
##83


Samsung Internet

4
QQ Browser

Baidu Browser

7.12

KaiOS Browser

2.5


But for a project that does not use npm and is just a simple html file, how to deal with the error when opening it in IE browser?

Solution

1.Introduce babel-browser.min.js

To solve this we must first introduce babel-browser.min.js , so that you can use ES2015 for coding

2.Introduce browser-polyfill.js

Solve the problem of arrow function or promise or async, awite incompatibility

3.After introduction Add type="text/babel" to your js file. After adding it, you will find that ES6 syntax can be supported at this time.

<script  type="text/babel">
省略js代码
</script>
Copy after login
This solves the problem of IE not recognizing ES6.

【Related recommendations:

javascript video tutorial

,

web front-end

The above is the detailed content of Is ie6 compatible with es6?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
es6
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template