Different browsers have different compatibility with JavaScript. Especially between IE and other browsers. Even different versions of IE may be different. There are three solutions:
BKJIA recommended reading: Javascript solves Common Browser compatibility problems
◆ Check the browser name and version and write different codes
◆ Write JavaScript-compliant code and run it on a browser that supports this standard
◆ Use JavaScript frameworks like jQuery that are compatible with processing
The second type is not realistic at present, because IE6 has a large market share, while IE7, IE8, Firefox and other browsers occupy a considerable market share, compatibility issues cannot be completely solved by standards, but can only be viewed in the future. browser developers consciously follow international standards.
The third is actually a roundabout way to hand over compatibility to third-party developers. Many small and medium-sized enterprises will choose this approach, and even some large enterprises will use this framework, such as Google. However, in some cases, you may not want to use the framework, maybe because the application is very simple. You do not want to use the same heavy framework, or maybe it is another reason. In this case, you must consider the compatibility issues yourself.
First, it is the most common practice, but there are flaws, that is, there are some situations where it is not accurate to determine the type version number of the browser. For example, other browsers using the IE kernel, such as roaming. In this case, you can choose whether the browser running the current Code supports the JavaScript feature you are using. Someone specially wrote the test code and provided it for free. Below is the link:
Test of basic features: http://yura.thinkweb2.com/cft/
Styles Support Test: http://yura.thinkweb2.com/cft/style.html
Event Support Test: http://yura.thinkweb2.com/isEventSupported/
The site is in English, but you can view the features in the table to know the test project.