Internet Explorer 11: Internet Explorer is no longer an Internet Explorer.

Source: Internet
Author: User

Microsoft just released the first Internet Explorer 11 pre-release for Windows 8.1 last week to respond to previous Internet Explorer 11 leaks. We have confirmed some new features in Internet Explorer 11, including support for WebGL, pre-capturing, pre-rendering, flexbox, mutation observers, and other Web standards. But what's more interesting is that although it is called Internet Explorer 11, it is no longer Internet Explorer.

This is also the first time Microsoft has removed some features of Internet Explorer: changed the user-agent string, which makes a lot of code that determines whether the browser is IE unable to work, including some JavaScript isIE () will return false if the method is executed on Internet Explorer 11. However, Internet Explorer 11 has excellent support for Web standards, so it does not need the specific behaviors of Internet Explorer.

In Internet Explorer 11, the user-agent version is much shorter than the previous version, and the key MSIE keyword is removed:

Internet Explorer 11 user-agent:

 
 
  1. Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv 11.0) like Gecko 

Internet Explorer 10 user-agent (on Windows 7 ):

 
 
  1. Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0) 

The above user-agent also adds the Gecko identifier, while Safari is the first browser labeled with Gecko.

In the past, most MSIE was used to determine whether the code of the IE browser could not work. You can use the Trident string to determine whether the code can work. The Trident identifier is introduced in IE9.

In addition, Microsoft has changed the navigator object:

  • The value of navigator. appName is "Netscape"
  • Navigator. product value: "Gecko"

This may be a developer's trick, but it is actually specified in HTML5. In HTML5, the preceding values must be returned for these two attributes. This is a strange rule. What's more strange is that Internet Explorer 11 complies with this rule.

This results in some JavaScript code that determines the browser Model Based on the navigator object to identify Internet Explorer 11 as a browser based on Gecko.

Document. all and friends

Since IE 4, document. all plays an important role in IE. Compared with document. getElementById (), document. all is a method for Retrieving Element references in IE mode. Although IE 5 has added support for DOM, document. all has been used until IE 10. Internet Explorer 11 is finally discarded, which means that document is used in Internet Explorer 11. the all method may cause execution failure, even though the document. all code can still work. [3]

The attachEvent () method is used to add an event processor. The corresponding detachEvent () is used to remove the event processor. These two methods will be deleted in Internet Explorer 11. To remove these two methods, use the following logic:

 
 
  1. function addEvent(element, type, handler) { 
  2. if (element.attachEvent) { 
  3. element.attachEvent("on" + type, handler); 
  4. } else if (element.addEventListener) { 
  5. element.addEventListener(type, handler, false); 
  6.    } 

Of course, we recommend that you use a standard browser for testing to ensure that code execution is not affected by the removal of attachEvent. However, the Internet is filled with a variety of bad monitoring code. You can only ensure that your application has undergone good standard tests.

The deleted features also include:

  • Window.exe cScript ()-eval () of IE version ()
  • Window. doScroll ()-IE used to scroll the window
  • Event Notification for script. onreadystatechange-IE script Loading completion
  • Script. readyState-IE: Check whether the script is loaded.
  • Document. selection-IE method to obtain the selected text
  • Document. createStyleSheet-IE method to create a style sheet
  • Style. styleSheet-IE reference style

All of these obsolete methods have standard-based alternatives. If you are using a standard method, congratulations, you can directly support Internet Explorer 11.

Conclusion

It seems that Internet Explorer 11 should be the best version in the Internet Explorer family. Microsoft is finally preparing a truly standard browser for you by removing some of the Devil-like errors in the past.

Update (): document. all is not actually deleted, but is not recommended.

Via nczonline/oschina Translation

Related Article

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.