Internet Explorer 11 Browser Introduction: Don't Call me ie_ basics

Source: Internet
Author: User

Last week, Microsoft officially launched the first preview version of Internet Explorer 11 with Windows 8.1. In this way, rumors of a leaked version of the controversial web browser should rest. We now know some important details about Internet Explorer 11, including support for WebGL, prefetch: Pre-read, such as uploading a preview of a file, not knowing the right to translate, PreRender (pre-presentation), Flexbox, Mutation observers and other web standards, perhaps more interestingly in IE11, is that it is not ie.

For the first time, Microsoft has removed some features from Internet Explorer browsers. The user-agent string has also changed. It appears that Microsoft has abandoned its own way, so that the existing code branch for detecting IE will return false in Internet Explorer 11 browsers, whether in JavaScript or on the server.

The change of User-agent

Compared to previous versions, Internet Explorer 11 has a shorter user-agent string, and there are some interesting changes:

Copy Code code as follows:

mozilla/5.0 (Windows NT 6.3; trident/7.0; RV 11.0) Like Gecko

For the user-agent string of Internet Explorer 10 on Windows 7

Copy Code code as follows:

mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; trident/6.0)

The most obvious difference is that the "MSIE" tag of the Internet Explorer browser user-agent string has been removed. Equally noticeable is the addition of the "Like Gecko" at the tail end of the user-agent. This indicates that Internet Explorer prefers to be recognized as a gecko browser, rather than being recognized as Internet Explorer itself. Safari is the first to add a "like Gecko" browser so anyone can sniff the "Gecko" character inside the user-agent string to allow the browser to pass.

Any sniffer code looking for "MSIE" now does not work under the new User-agent string. You can still search the "Trident" character to determine that it is IE browser ("Trident" logo is launched with Internet Explorer). The true version of Internet Explorer is identified by "rv".

In addition, there are some changes to the information of the Navigator object, which is more masking the browser in use.

Navigator.appname is set to "Netscape"
Navigator.product is set to "Gecko"

This may seem like an attempt to sneak up on developers, but these are actually HTML5 specified. The navigator.product attribute must be "Gecko" and navigator.appname should also be "Netscape" or more specific. But Internet Explorer 11 missing follows this strange suggestion.

The side effects of changes in navigator information, and the use of JavaScript-based browser instrumentation that is being used may not be available, resulting in Internet Explorer 11 being recognized as gecko based browsers.

Document.all and his friends.

Since IE4, document.all has been omnipotent in IE browsers. Similar to the previous implementation of document.getElementById (), document.all is the way to get a DOM element to refer to IE. Although the DOM has been supported from IE5 to Ie10,document.all. In 11, however, the legacy of this era has been set to return false, which means that any document.all based code branch judgment will fail in IE11, even if the code actually uses document.all to work properly.

Another legacy is the attachevent () that adds event functions, similar to the DetachEvent () method. This method has been removed from the IE11. Removing these methods is to avoid some logical judgments, such as:

Copy Code code as follows:

function addevent (element, type, handler) {
if (element.attachevent) {
Element.attachevent ("On" + type, handler);
else if (Element.addeventlistener) {
Element.addeventlistener (type, handler, false);
}
}

Of course, we recommend that your best test version is consistently consistent and standard. At some level, the removal of the Attachevent method does not produce any adaptation. However, the Internet is flooded with the characteristic detection logic code of the cake. The deletion of the Attachevent method ensures that any code written in the above manner will use the standard version instead of IE-specific methods.

Some other features that have been removed:

IE version of the Window.execscript ()--eval () method

Scrolling method of Window.doscroll ()--ie window
State change for listening to load scripts in Script.onreadystatechange--ie
State of script loading in Script.readystate--ie
The text currently selected in Document.selection--ie
Create style sheet in Document.createstylesheet--ie
Style.stylesheet--ie a Style object referencing a style sheet in the browser
All of these IE browsers are replaced by standard features. After removing these features and methods, cross-browser code that is detected based on standard feature features can still function without change.

Conclusion
Over a long period of time, IE11 may be the best IE browser. Microsoft is finally getting ready to eliminate past mistakes and is ready to start from a browser that includes standards based on the present. Removing old features and modifying user agent strings that are not identified as IE browsers is a unique approach to ensuring that all Web sites continue to work. If the Web application uses feature detection rather than browser sniffing, the code should be able to run in IE11. For applications that use user-agent sniffing, users can still see a full-featured Web site because IE11 is very good at standard support.

A future without IE branching code is coming, let's look forward to it together.

(Updated in 2013-7-2), the document.all mentioned in the amendment have not actually been deleted and replaced by the Falsy

 long time no translation of the article, this translation is Nicholas C. Zakas Daniel's blog, the original in this: http://www.nczonline.net/blog/2013/07/02/ internet-explorer-11-dont-call-me-ie/
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.