The browser wars and the birth of JavaScript

The browser wars and the birth of JavaScript

“Any application that can be written in JavaScript will eventually be written in JavaScript.” — Atwood’s Law, stated by Jeff Atwood in a blog post titled “The Principle of Least Power,” July 17, 2007

Before anything like an Android device or iPhone existed, desktop computers were the battleground for the browser wars. The battle involved billions of dollars invested by a number of companies, all based on the premise that whoever ruled the desktop browser market would own the internet. Today, mobile devices account for nearly half of all website traffic. Back in the 1990s, however, almost all of the action on the web came from desktop machines, and the vast majority of those desktop machines were running some flavor of Microsoft Windows.

In the browser world, the first-mover advantage belonged to Netscape Communications Corporation. They built the Netscape Navigator browser that made the web accessible to millions for the first time. Netscape had more than 80% of the market, but they also had no shortage of competition. IBM had a browser for OS/2. Oracle had the Powerbrowser, a Netscape-compatible product that included something called the Database Markup Language. The real danger to Netscape, of course, came from the company that owned more than 80% of the world’s desktops: Microsoft.

Strategically, Netscape realized that the web needed to move past static web pages to reach its full potential. Even if they were created dynamically by something like a CGI script on the web server, pages didn’t change once they arrived in your browser. If you wanted to see even a slightly modified version of a page, you had to send a request back to the server and wait for a response. For all its sophistication, a web browser felt a lot like a dumb terminal attached to a mainframe. What web developers needed was a programming language that would run in the browser, taking advantage of the processing power of the desktop machine to give users a richer experience.

So in 1995, hearing footsteps from Redmond, Netscape decided to shoot for the moon and create that language. Netscape CEO Jim Clark had brought in a gifted programmer named Brendan Eich, who arrived with the idea of implementing the programming language Scheme in the browser. Scheme was adored in academia, but didn’t have much traction in the marketplace. Eich thought it might be a good fit for programming web pages. He later referred to Scheme as “that beautiful research language I was tempted with.”

Only there was a complication: Netscape had licensed Java from Sun Microsystems. A commonly held opinion was that Java should be the language of the browser. Unfortunately, Java was too heavy for the slow connections most people had in those days. Developers had to compile their code and then deliver that code to the browser. Good luck if your code needed a different version of Java than the one the user had on their machine. This meant they needed the patience to download a Java Virtual Machine that was 10 MB or more (!) across a connection too slow for many of today’s users to comprehend. Back then, the web page and whatever non-Java content it contained were probably no more than a couple hundred KB; there was just too much overhead for Java to work.

In contrast, Eich, Netscape’s Marc Andreessen, and Sun’s Bill Joy all agreed that the world needed a BASIC-like language that would be a good fit for people who didn’t know what a compiler was. Should anyone creating a web page have to understand what public static void main(String[] args) means? Eich didn’t think so.

The decision was made to create a new programming language and to release that new programming language in Netscape Navigator 2.0. That decision was made Ten. Days. Before. Launch. Eich spent those 10 days creating LiveScript, later renamed JavaScript. (As he said years later, “I didn’t sleep much.”) Suddenly, developers could add logic to their web pages. Even better, the language was directly tied into the things web developers wanted to work with, including the Document Object Model (DOM) for a page’s HTML content and objects like the browser window itself. If you wanted to go through the page’s document structure and work with it, JavaScript could do that easily. If you wanted to resize or move a window or open a new window altogether, JavaScript could do that easily.

<!--[if !IE]>

On a personal note, a story from the International House of Hubris: in March of 1996, I was in San Francisco for the first Netscape Developers Conference. I don’t remember the name of the young, Zegna-clad millionaire who said it, but he told the audience that you could write for Netscape Navigator…and if you wanted the other three percent of the web, you could target Internet Explorer. Much snickering ensued.

<![endif]-->

Everything you need to grow your career.

With your free Red Hat Developer program membership, unlock our library of cheat sheets and ebooks on next-generation application development.

SIGN UP

<!--[if IE]>

The following week, I stayed in San Francisco to attend the Microsoft Professional Developers Conference, the show where Bill Gates and company finally understood the internet. If you have some time to kill, watch Gates’ keynote. Seriously. It changed the world we live in. The keynote included demos of games, virtual reality, and state-of-the-art web design, all of which look hilarious now. There was also a demo that ended with the Blue Screen of Death in front of thousands of people; however, that doesn’t seem to be in the archives. (No judgment, we’re all programmers, we’ve all been there. Although maybe not in front of thousands of people while our boss, a.k.a. the richest man in the history of money, looked on.)

At the show, Microsoft announced a full-out pivot to make everything in their product line internet-enabled in one way or another. This was an escalation of their ongoing attacks on Netscape’s business model. In late 1996, Netscape Navigator still had 80% of the market and a list price of $49. (Yes, you had to pay money to get a browser. Talk to your grandparents about what it was like back then. Also, ask them about something called “dialup.”) Not only was Windows going to contain a free web browser, but Microsoft was giving away a web server as well. Unfortunately, it turned out Internet Explorer wasn’t quite compatible with Netscape and other browsers to come, creating a thorn in the side of every web developer on Earth for the next 15 years or more.

At any rate, I left San Francisco convinced that Netscape had no idea what was about to hit them. I was also convinced that Virtual Bubble Wrap, a Flash-based game that ran in Netscape Navigator, was the greatest use of the Internet ever. I believe I was right on both counts.

<![endif]-->

The little language that could

So, why are we still talking about JavaScript 20+ years later? First, it became a hit on the client side. In 1996, if you were a web developer who wanted to write an interactive web page, you had to learn JavaScript. In 2019, if you’re a web developer who wants to write an interactive web page, you have to learn JavaScript. Innovation didn’t stop with the first scripted web pages of the mid-90s, however.

JavaScript’s influence became more apparent as applications like Google Maps established a whole new level of interactivity. At one time, mapping websites showed you a static view of the world. If you wanted to see another portion of the map (zoom out, zoom in, move north/west/south/east, etc.), you clicked a button and waited for the server to show you a different map. Google Maps, on the other hand, used JavaScript to prefetch other parts of the map that you might want to see. If you scrolled in one direction or another, the map displayed instantly and automatically. Static maps that required a round-trip to the server every time you wanted to move around were quickly abandoned.

JavaScript’s dominance was cemented by the emergence of Node.js on the server side. At a minimum, it gave web developers the ability to take their JavaScript skills from the client to the server. Combined with the ability to pass functions as objects (callbacks), Node.js’s event loop popularized a whole new programming model. Suddenly, you could write a web server in just a few lines of code.

Then, the rise of the Node Package Manager (npm) to manage dependencies meant a very small application could leverage other packages to do really sophisticated things. As a self-serving example, the knative-proxy package in the Coderland Compile Driver needs fewer than 40 lines of code to handle the HTTP POST and OPTIONS verbs. And it took yr author maybe 30 minutes to write.

JavaScript is a simple, unpretentious language that has its fingers in every corner of your life. Turn off JavaScript in your browser and see how much of the web doesn’t work anymore. (Philosophical arguments as to whether that’s a good or bad thing are left to the reader.) No matter how or where you use the internet, Brendan Eich’s 10-day coding spree is the most important sprint in the history of computing. You don’t have to like JavaScript, but if you make a living developing for the web, you have to learn it.

To learn more, tune in to Command-line Heroes Season 3, Episode 3: Creating JavaScript.

Join the Red Hat Developer Program (it’s free) and get access to related cheat sheets, books, and product downloads.

Share