Introduction to browser kernel and rendering mode

Source: Internet
Author: User

The first is to introduce a concept-typesetting engine (layout engine,rendering), which is the browser kernel that most people who surf the internet may have heard of, and are responsible for parsing page syntax (such as HTML, JavaScript) and rendering, Display Web pages . the core of each brand browser is different, and different cores have different ideas when dealing with the same piece of code. So it can be said that the difference between the browser cores is the root cause of the compatibility problem. That's why we have to push front-end engineers to unification the browser. Of course, this is just a dream, so we return to the reality, below I will be four kinds of common browser kernel for a brief introduction.

Trident

Trident (ie kernel): This kernel program was first adopted in the 1997 IE4, which was modified by Microsoft on the basis of mosaic code, and used in IE11, also known as the "IE kernel". Trident is actually an open kernel, its interface core design is quite mature, so there are many using IE kernel instead of IE browser (Shell browser) emerges. Due to the "monopoly" of IE itself, which makes the Trident kernel long-term one, Microsoft has not updated the Trident kernel for a long time, which leads to two consequences-one is that the Trident kernel was almost out of touch with the Standard (2005), and the second was a large number of Trident cores Bugs and other security issues are not resolved in a timely manner, and then with some developers working with open source and some scholars to open their opinion that IE browser is unsafe, there are many users to other browsers, Firefox and Opera is the rise of this time. The significant increase in the market share of non-Trident kernel browsers has also led many web developers to pay attention to web standards and non-IE browser browsing effects. Most of the domestic browsers (such as 360) are "dual-core" or even "multicore", one of which is Trident, and then an additional kernel is added. Domestic manufacturers generally call other cores "high-speed browsing mode", while Trident is "compatible browsing mode", users can switch back and forth. (add: IE starts with version 11 and initially supports WEBGL technology.) IE8 's JavaScript engine is JSCRIPT,IE9 start with Chakra, these two versions differ greatly, chakra both speed and standardization are excellent. )

Gecko

Gecko (Firefox kernel): Netscape6 began to adopt the kernel, and later Mozilla Firefox (Firefox) also adopted the kernel, Gecko is characterized by the full disclosure of the code, so it can be developed to a high degree, Programmers all over the world can write code for it, adding functionality. Because this is an open source kernel, so favored by many people, Gecko Kernel browser is also many, this is the gecko core although young but the market share can quickly increase the important reason.   Presto

Presto is a browser typesetting engine developed by Opera Software, which currently uses this engine in the 7.0~10.00 version of opera. Presto is characterized by the optimization of rendering speed to the extreme, it is now recognized as the fastest browser core Web browsing, but at the cost of sacrificing the compatibility of the Web page.

Presto is actually a dynamic kernel, the biggest difference with Trident, Gecko and other kernels is the script processing, Presto has a natural advantage, all or part of the page can be re-parsed in response to the script event. In addition, the kernel has the fastest execution of JavaScript, and according to tests under the same conditions, the Presto kernel takes only about 1/3 of the Trident and Gecko cores to perform equivalent javascript. However, the disadvantage is that Presto is a commercial engine, the use of Presto in addition to opera, only the NDS Browser, Nokia 770 Web browser, which to a large extent limited the development of Presto. The Opera widget engine uses the Presto engine.

Webkit

Webkit (Safari kernel, chrome kernel prototype, open source) : It is Apple's own kernel and the kernel used by Apple's Safari browser. The WebKit engine includes the WebCore typesetting engine and the JavaScriptCore parsing engine, all derived from KDE's khtml and KJS engines, which are free software, licensed under the GPL, and supporting the development of BSD systems. So WebKit is also free software, while open source code. In terms of security is not affected by IE, Firefox, so Safari browser is still very safe at home. limited to the use of Mac OS X is not widespread and Safari has been just Mac OS X's exclusive browser, the kernel itself should say the market is not large, but it seems that according to the latest browser survey shows that the browser market has even surpassed Opera's Presto- This, of course, is due to the popularity of Apple's move to the x86 architecture, and the fact that Safari 3 has finally launched the Windows edition. There are also popular browsers such as OmniWeb, Shiira and so on under Mac. Google Chrome, the 360 speed browser, and the Sogou browser Express mode also use WebKit as the kernel (for scripting, Chrome uses its own V8 engine). The WebKit kernel is also widely used on mobile phones, such as Google's phone Gphone, Apple's iphone, and the browser kernel engine used by Nokia's Series browser, all based on WebKit.  Another concept is introduced below, and the browser's working mode is also known as the "rendering mode". In fact, the different working modes of the browser not only affect the rendering, but also affect the parsing of the code and the behavior of the script. so the same kernel, different rendering mode will also produce compatibility problems. Let's look at the source of the rendering mode:

Microsoft's IE6 (Internet Explorer 6), released on August 27, 2001, enhanced the compatibility of CSS1 with 1, which made IE6 's parsing and rendering of CSS significantly different from its previous version IE5.5, such as the understanding of box models 2, table size algorithm 3 and so on.

To maintain good backwards compatibility, Microsoft provides a "switch" for users to determine the browser's operating mode 4, which is the DTD at the top of the page.
Some DTDs will enable IE6 to work in "Standard compatibility Mode" ("Standard Mode"), which uses IE6 's latest processing, including CSS1 compatibility and some DHTML enhancements.
Other DTDs, including not setting DTDs, will make IE6 work in "Backward compatibility Mode" ("Promiscuous Mode"), which is consistent with IE5.5, which ensures that pages that perform well in IE5.5 can achieve the same results in IE6.
Microsoft in the subsequent launch of the IE7, IE8, also used the above "switch", like IE6, in the IE7, IE8 "promiscuous mode", the page processing mode is still consistent with IE5.5. Therefore, it can be said that the "promiscuous mode" of the IE series, the behavior of the browser freezes in the IE5.5 version, although the version of the IE hybrid mode is slightly different 5, but their intentions are backwards compatible.

As time progresses and standards progress, IE6, IE7 's "Standard Model" has gradually become inadequate, the March 19, 2009 release of the IE8 redefined the "standard mode", once again enhanced the support of the standard specification, and in order to maintain the compatibility of IE7, IE8 added a mode of work: " Close to the standard mode. Thus, IE8 's working mode is divided into three types: "Standard mode", "close to Standard mode" and "Promiscuous mode" 6.

All major browsers currently handle backwards compatibility issues like the IE series, providing different modes 7来 guaranteed backwards compatibility.

The browser's working mode is born in this context, it is a good solution to the browser on the standard support of the continuous enhancement and the repair of some errors caused by the backward compatibility problem, but also the browser in different situations of performance and behavior become more complex and diverse.

Through the above, we can conclude that if a page can make each browser work in the "Standard mode", then each browser will try to be compatible with the standard, so the differences between browsers are very small. Conversely, if a page makes each browser work in "Promiscuous mode", then each browser will be as backwards compatible as possible, so the differences between browsers will be maximized.

Appendix: Some common DOCTYPE
when writing a page, use a DTD that triggers the "standard mode" of each browser and write code that conforms to the specification to ensure that your pages are compatible to the fullest extent in each browser. I believe you see these will have a better understanding of browser compatibility, at least to know the source of the evil bug.

Introduction to browser kernel and rendering mode

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.