I've decided to write a novel about this in hopes that people will gloss over it and upvote me. No, no, just kidding! I suffered over every word. Every word, I tell you!
Ask 'when' before 'why'
All major web browsers can trace their origins back to the 90s. Konqueror became Safari and Chrome; Netscape became Firefox; IE and Opera are still IE and Opera. These browsers all have a 15 year head start on incumbents.
I suggest you even try to name an acceptable cross-platform (Windows/Mac/Unix and even worse) language that was available in around 1995 when modern browsers originated. To build the core in anything but C/C++, you'd probably have had to build or buy and modify a compiler and platform libraries.
How about today? What are the alternatives?
Just for fun, let's think about the problem today. Yes, there are alternatives, but there are still major problems.
Language choice presents at least these problems:
- Knowledge problems - Hiring/training developers or attracting contributors
- Organizational/social problems - Language acceptance
- Language implementation: Speed, platform support, tooling
- Language power
1: Knowledge problems
Where do you get people who know the language or can learn it? This is an obstacle for languages like OCaml, F#, Haskell, Common Lisp and D that are fast and high-level enough to write a browser in nicely, but have few followers (In the 10k-100k range, maybe) even if you liberally count all the hobbyists and academics.
2: Social/Organizational problems
Corollary to the cargo-cult answer above:
- An open source browser not using C, C++, C# or Java will supposedly have difficulty with contributors.
- A proprietary browser not using C, C++, C# or Java will get project managers severely yelled at in most organizations.
3. Technical problems
Cross-platform development is another bag of worms. You could use C# or F# and cross your fingers on GTK# and Mono being alive and well in the future. You could try Common Lisp, Haskell, OCaml... Good luck getting everything working on Windows and Mac and Linux.
4. Language Power
After all of that, you have to build an enormous amount of functionality, so if you choose a low-level language you need an even huger army of coders than before. Note that no one has really built a browser from scratch in about fifteen years. That's partly because (surprise!) it's hard.
If you developed a three-platform (Windows/Mac/*nix) browser today, what are the choices?
- C: See (2). Everyone's going to clamor for C++. Have fun selecting a cross-platform toolkit or building one (1, 2, 3 and 4). See also (4); have fun building a stable, secure browser in it.
- C++: Have fun selecting a cross-platform toolkit or building one (1, 2, 3 and 4). Have fun (4) building stable, secure browser in it.
- C or C++ and HLL: Your best bet. Pick your poison on the dynamic language; See (1) and (2). Too many good languages, too few followers of each. (1, 2, 3 and 4) on toolkit.
- Java: Second best bet, if you have to please middle management. See (4); building huge things in Java takes a lot more code than in anything else on this list but maybe C.
- Scala: Beats Java on (4); (1) and (2) but it's catching on.
- C#: Have fun on (3). You're probably stuck with GTK#, however good that is, or building your own layer and renderer above GTK# and Windows Forms.
- Ruby/Python/Perl/Racket/Lua/Erlange etc.: You've got (3) on cross-platform widget libraries and speed. Moore's law is with you on (4); the growing demand on browsers is against you.
- OCaml, Haskell, Common Lisp, Smalltalk: (1) and (2) in spades. No speed issues, probably, but (3) for cross-platform development, and you'll have to build your own everything or bridge to C/C++ libraries somehow.
- Objective-C: (3) I'm not sure how cross-platform development would work out here.
If we see another major browser rise in the next few years, I would bet it will be written in C or C++ and a dynamic language (Like Firefox), whether open source or proprietary.