In 1995, Netscape Navigator was enjoying a meteoric rise to the top of the browser market. They had only released the first version of their browser a year prior, but already it was a crowd favorite and was bolstering the growing popularity of the web. But employees at Netscape were constantly looking over their shoulder, knowing full well that Microsoft was due to enter the market at any moment (they soon would). Netscape needed to keep itself on the cutting edge.
One of the ideas that was being thrown around at Netscape was a new scripting language that could run right in the browser. A language that could be used to enhance the mostly static features of HTML and let developers move things around the page. Now that would be a killer feature.
To make it happen, Netscape turned to Brendan Eich, who had actually been offered a position when the company first got off the ground, but passed on the opportunity. Now, a year later, Netscape approached Eich with a new, much more enticing, proposition to create a brand new programming language, born from and made for the web.
Eich was a bit of a programming language geek, dabbling in a dozen or so languages even as a student. So to sweeten the pot, Netscape pitched him on the idea of Scheme in the browser. See, it would have been exciting for him to develop any new language. But the idea of basing it off Scheme was particularly thrilling to him. Scheme is a dialect of Lisp and it’s a favorite among many programmers, Eich included, for its simplicity and powerful nature. So, compelled by their offer, he joined Netscape in April of 1995.
Around the same time, Netscape laid the groundwork for a deal with Sun Microsystems. Sun had been getting a lot of attention for their own new programming language, Java. Netscape was in early talks to license the language and embed a Java Virtual Machine (JVM) right in Navigator which would allow developers to build complex Java applications (later called applets) and run them on the web.
So that changed things a little at Netscape. If they moved ahead with “Scheme for the browser”, Sun was less likely to close the deal. What they really needed was a companion language, because by its very nature, Java is difficult language to manage without a background in computer science. It’s extremely powerful, but relies on complex principles like object oriented programming.
The web, on the other hand, was a cobbled together community of hobbyists and enthusiasts. Some had years of experience in the computer science field. Others had none at all. So any language made specifically for the web, needed to be both powerful and approachable to the average developer. Something that would allow developers to change text, move elements around, and generally experiment, without errors flashing on screen every time they screwed up. A scripting language that could easily be embedded right into the HTML of a webpage, that was still powerful enough to lay down a foundation for more adventurous programmers looking to build complex applications.
There was a slight issue. By the time Eich was able to get started, the Java deal was just days away. 10 days, actually. And a demo of Mocha needed to be ready to go before the deal went through. But it got done. The demo itself was fairly simple, reflecting the strength and versatility of this new browser language. When Eich typed
mocha: into Netscape’s address bar and hit enter a console opened up as a set of frames displayed in the browser. In one frame was a text input. Each time something was typed into the input it was displayed in the second frame. This was built directly into the browser, and it made the web instantly dynamic and interactive.
script tag developers were able to create fairly complex applications. There were some peculiarities and bugs of course, but almost right away Netscape saw examples out in the wild. Examples like calculators and form-based applications and even the first iterations of single page applications.