Welcome | Sign In
LinuxInsider.com
Developer

KHTML vs. Gecko vs. Trident vs. Presto: Behind the Browser

Print Version
E-Mail Article
Reprints
KHTML vs. Gecko vs. Trident vs. Presto: Behind the Browser

"Why do we want more than one layout engine? It helps to spur innovation and means that if a flaw occurs it won't necessarily be in every browser at once. Having some different implementations of anything is a good thing," Gene Spafford, computer science professor at Purdue University, told LinuxInsider.


When a Web surfer clicks on an icon to launch his or her favorite Web browser, only the geekiest of the geeky pay any thought to which engine layout is at work. The typical Web user has no clue that a different browser choice may also include a different browser layout engine.

If anything, most Internet users concern themselves about which Web browser is more secure. Should they worry instead if older versions of Apple's (Nasdaq: AAPL) browser were better because they used KHTML? Or that maybe the security and usability of Mozilla's Firefox browser is better because it uses Gecko? Could Microsoft's (Nasdaq: MSFT) Internet Explorer 7 (IE7) be a better browser choice today because it uses the Trident engine? Why are there so many different options to begin with?

"Why do we want more than one layout engine? It helps to spur innovation and means that if a flaw occurs it won't necessarily be in every browser at once. Having some different implementations of anything is a good thing," Gene Spafford, computer science professor at Purdue University, told LinuxInsider.

What Are They?

The three main Web engines in mainstream use today are Trident, Gecko and Presto. IE7 is based on the Trident layout engine.

Mozilla uses Gecko in Firefox and the Thunderbird e-mail Increase Customer Sales with Email Marketing -- Free Trial from VerticalResponse client, as do several other open source Web browsers. Opera Software uses Presto as the layout engine in its browser. So does Nokia (NYSE: NOK) in its Internet Tablet products. Also, Nintendo products are based on the Presto engine.

Apple eventually broke from the KHTML mold. It used some of the KHTML code and grew it into its own Web engine called WebKit.

"KHTML doesn't really exist in a relevant fashion anymore," Guy Lunardi, product manager for Novell (Nasdaq: NOVL), told LinuxInsider.

Do Differences Matter?

Both the Apple Safari browser and the Apple iPhone use WebKit. However, WebKit's popularity extends beyond Apple, according to Lunardi.

Adobe (Nasdaq: ADBE) AIR (Adobe Integrated Runtime) and Nokia's smartphone line are using WebKit today.

Don't, however, suggest to Lars Knoll, the creator of KHTML who is now a software developer for Trolltech, that his legendary browser layout engine is a has-been. KHTML's source code is a lot smaller and easier to work with than Gecko, he explained.

"In terms of what's new with KHTML, I think the main news currently is the ongoing effort of trying to mend the fork between KHTML and the WebKit project," he told LinuxInsider in an interview from his office in Oslo, Norway.

In the Beginning

KHTML began as part of KDE 2.0, a desktop environment in some Linux operating system distributions. KHTML was an endemic part of the Linux Web browser Konqueror and KDE's integrated KHTML-powered Web browser and file manager.

It was a mainstream rendering engine solution as the popularity of the Netscape browser was waning. Back then the folks at the Mozilla Foundation were still experiencing the birth trauma of separating its open source browser from the Netscape source code around Gecko.

"While the focus of Gecko in the early years has been to build up a complete development platform, KHTML has always just focused on being an HTML rendering engine," Knoll said. "The idea behind KHTML was to create a standards-compliant HTML rendering engine that could handle all -- at that time -- modern Web pages using CSS (cascading style sheets) and JS (JavaScript)."

Mozilla/Gecko was a project paid for by Netscape and then AOL. Later, the Mozilla Foundation fostered a large amount of paid people working on the Gecko engine, he added.

"KHTML was a project purely driven by volunteers until Apple got involved. None of the people that worked on KHTML until 2003 ever got paid for the work we did," explained Knoll.

The Path Divided

The goals of both rendering projects are similar. While many differences exist on the inside, they both provide a standards compliant HTML engine that can deal with all Web pages built on the net. Today, both engines support more or less the same feature set: HTML 4.1, XHTML, CSS 2.1, JavaScript and Ajax-type Web applications, said Knoll.

One of Knoll's main focus areas from the very beginning, he said, was to try to make the architecture as sound and as easy as possible for an HTML rendering engine. This made it a lot easier for people to start working and contributing to the project.

"It was also probably the main reason for Apple to go with KHTML instead of Gecko for its Safari Web browser," Knoll proffered.

Novell's Lunardi agrees that the performance among these Web browser layout engines is seamless. They all have to implement a lot of standards and specs, including HTML, CSS, XML Document Object Model, RDF (resource description framework), JavaScript and much more.

Same Differences

These different engines exist because they were developed by different groups for different needs. In reality, they all provide generally the same end goals.

"As such, they will handle the combinations of these in different ways. They will be true to the specifications in different ways. They will handle errors and poorly formatted content in different ways," Lunardi said.

Knoll maintained the KHTML project until 2003, when others took over so he could move on to related work. In a sense, his work as a software developer has come full circle. Last autumn he went to work on WebKit, trying to get that rendering engine integrated into the Linux desktop environment KDE 4.

No Best Choice

Users would be hard-pressed to select a specific Web browser solely on the basis of which layout engine it uses. None of the engines residing on the same system cause conflicts for users or headaches for software developers, according to Knoll.

The choice of layout engines is largely a flavor additive for browser developers. For instance, KHTML is a lot better suited for embedded devices due to its smaller memory footprint. Gecko has more market share, explained Knoll.

Some minor issues exist for Web developers, but most of these are fairly trivial, Knoll said. The biggest headache for Web developers is probably the difference between the browsers that aim at standards compliance (Gecko, KHTML and WebKit) and IE.

"In the end, it's often a matter of taste which browser someone uses. On Linux one has three possibilities: Firefox -- or another Gecko-based browser -- Konqueror or Opera. As a user, you can simply pick whatever you like best," Knoll concluded.

Why Not One?

Why shouldn't there be a single standard engine for all browsers? Knoll sees two reasons why having just one rendering engine would not be good for consumers.

Having only one implementation will never give you any guarantees that what the engine implements matches the documentation. It will also never guarantee that standard is implementable by anyone else, he said.

Having several engines is good, as it triggers competition -- there is no need to improve if you have a monopoly, he reasoned, echoing Spafford's view.

"We've seen this in the browser area in the last years, where every engine tries to be as fast as possible and/or as standards-compliant as possible," he said.


Print Version E-Mail Article Reprints More by Jack M. Germain


Talkback: Join the Discussion.
Re: KHTML vs. Gecko vs. Trident vs. Presto: Behind the Browser
Nanobot
Posted 2007-09-14
As a web developer, I believe that the issues with Trident have been significantly downplayed in ...

More by Jack M. Germain

Microsoft FOSSifies .Net Micro Framework
November 18, 2009
Microsoft has declared its .Net Micro framework open source under the Apace 2.0 license. Not all bits of .Net Micro are covered, however. Its TCP/IP stack has been stripped, as has its cryptography libraries. Rights to the TCP/IP stack aren't Redmond's to give, and the cryptography libraries are used outside of the scope of the .Net Micro framework, according to the company.
New Ubuntu OS Features Create Good Karma
November 13, 2009
Amidst the OS upgrades from Apple and Microsoft over the last few months, the Linux OS Ubuntu got a version bump of its own. Ubuntu 9.10, or Karmic Koala, is well worth the effort to upgrade, and its developers have made the process easier -- if you're using the full-sized desktop/notebook version. The Remix version, intended for netbooks, caused quite a few headaches.
Samsung Chimes In With Bada Mobile OS
November 11, 2009
With Android, iPhone, BlackBerry, WinMo, Symbian, WebOS and plenty other mobile platforms fighting for space, is there room for one more? Samsung believes there is, and it's announced a new open mobile platform called "Bada." The company, which already makes handsets for several existing platforms, says Bada will make app-making easy for developers. The first Bada handset should be out in the first half of 2010.
Don't miss a story -- sign up for our FREE e-mail newsletters and view the latest headlines at a glance.
Tech News Flash [ View Sample ]
E-Commerce Minute [ View Sample ]
ECT News Network Weekly Newsletter [ View Sample ]
Shortcuts
ECT News Network Information
Reader Services
Corporate
ECT News Network