DEV Community

Cover image for Server-side JavaScript a decade before Node.js with Netscape LiveWire
Matteo Cargnelutti
Matteo Cargnelutti

Posted on • Updated on

Server-side JavaScript a decade before Node.js with Netscape LiveWire

The year is 1996. JavaScript is less than a year old, making its grand public debut with the release of Netscape Navigator 2.0 to a both intrigued and somewhat bewildered web development community. We are at the very beginning of what would become "The First Browser War": how JavaScript evolved and grew in that context is a story often told, but did you know that JavaScript was also used as a server-side scripting language as early as 1996?

Today we're going to have a look at Netscape LiveWire, an extension of "Netscape Enterprise Server" that made writing server-side JavaScript applications possible more than 10 years before it was cool.


The dawn of server-side J(ava)Script

While Netscape and Microsoft were distributing their browser free of charge, both companies were also in the business of selling enterprise-level software to companies and institutions looking for a "one stop shop" solution to their web server and web development needs. This constituted an important part of Netscape's business model, and something Microsoft invested in as part of their newfound interest for the internet.

We therefore had Microsoft on one side with the "Internet Information Services" (IIS) suite, featuring their "Active Server Pages" (ASP) server-side scripting technology, and "Netscape Enterprise Server" with its LiveWire application development solution on the other.

While ASP did support JScript (Microsoft's early implementation of JavaScript), it was only one of the 3 languages supported, alongside VBScript and PerlScript. Netscape chose a different approach and went "all in" with server-side JavaScript, which was the centerpiece of LiveWire.


How did LiveWire's server-side JavaScript work?

Looking back at how LiveWire worked from today's perspective is both fascinating and slightly disorientating. We're only a decade - but galaxies away - from Node.js and its event loop-based, single threaded model. Netscape's server-side implementation of JavaScript was much more of an HTML preprocessor than a multi-purpose runtime, not dissimilar to early-days PHP in some of its inclinations.

Everything starts with the <server> tag

LiveWire introduced a <server> tag, the likes of ASP's <% and PHP's <?php delimiters, used to determine which parts of a given HTML file contained JavaScript logic that needed to be processed on the server before being sent to the client. A global write() function was used conjointly to "print" content on the page.

<!-- Welcome to mid-90s HTML. 
Tags are SCREAMED, because everybody is very excited about THE INTERNET. -->
<HTML>
  <HEAD>
    <TITLE>My awesome web app</TITLE>
  </HEAD>
    <BODY>  
    <H1>
      <SERVER>
      /* This tag and its content will be processed on the server side,
      and replaced by whatever is passed to `write()` before being sent to the client. */
      if(client.firstname != null) {
        write("Hello " + client.firstname + " !")  
      }
      else {
        write("What is your name?")
      }
      </SERVER>
    </H1>

    <FORM METHOD="post" ACTION="app.html">
      <P>
        <LABEL FOR="firstname">Your name</LABEL>
        <INPUT TYPE="text" NAME="firstname"/>        
      </P>

      <P>
        <INPUT TYPE="submit" VALUE="Send"/>
      </P>
    </FORM>
  </BODY>  
</HTML>
Enter fullscreen mode Exit fullscreen mode

To prevent unnecessary cluttering of the HTML files, backquotes could be used as a shorthand for the combination of <server> and the write() function, making for a smaller footprint:

<!-- Long form: -->
<H1><SERVER>write("Hello " + client.firstname + " !")</SERVER></H1>

<!-- Short hand: -->
<H1>`"Hello " + client.firstname + " !"`</H1>
Enter fullscreen mode Exit fullscreen mode

The jsac compiler and .web files

LiveWire apps required a compilation step. Using the jsac compiler, users had to merge all of the app's HTML and JavaScript resources into a single .web file. The idea was that every HTML file added to this bundle was to become an entry point for the app, accessible via a url, while loose JavaScript files were meant to be shared resources, allowing to define global functions that could be used in <server> calls across multiple HTML files.

The resulting .web files contained bytecode that could then be executed by Netscape's JavaScript runtime, waiting for HTTP requests to come in.

# Example: Compiling a LiveWire app made of a single HTML file.
jsac -i app.html -o app.web

# Example: Compiling a LiveWire app made of multiple HTML and JS files.
# The `-f` option targets a file containing references to all the files that need to be bundled together.
jsac -f files_list.txt -o app.web 
Enter fullscreen mode Exit fullscreen mode

Netscape's runtime was multi-threaded and allowed for sharing objects between threads of a given application. Shared objects could be accessed and modified by any thread, which made it easy to share state between clients but also came with important thread safety risks. A locking mechanism was available, but not automatically enforced.


What were some of its core features?

LiveWire was built for "enterprise" customers, and some of the architectural decisions that were made could be explained by this constraint.

There was for example a clear focus on database connectivity, interoperability with Java classes and native libraries (LiveConnect and jsacca), all of which making it easier for potential clients to integrate LiveWire into their existing infrastructure and codebases, at least in theory.

Netscape's server-side JavaScript implementation also came with APIs for session management, forms processing, file system access, and even sending emails in later versions, which made of LiveWire a seemingly complete and viable solution for backend development.


Was LiveWire a success?

LiveWire was a very interesting and innovative piece of software, but never came come close to becoming the gold standard of "professional" server-side development of the late nineties. While it is hard to pinpoint a single reason why that was the case, here are a few clues, in no particular order:

  • Having to compile and bundle everything, including HTML content, made for a somewhat cumbersome developer experience. This review of LiveWire's development cycle by Philip Greenspun describes these woes in great detail. LiveWire's direct competitor, Microsoft ASP, didn't require a compilation step.
  • JavaScript was a very young language at the time. It still had to prove itself, and hadn't yet become popular enough to have a large pool of developers and libraries available. This article by R. Allen Wyke from 1999 is a good example of how, even a few years later, JavaScript had to be advocated for.
  • Netscape didn't necessarily invest as much as its competitors, and LiveWire quickly lagged behind in terms of features. This 1997 article from the Chicago Tribune shows how LiveWire started to lag behind the competition, a year after its launch.

What did LiveWire become?

"Enterprise-grade" software means long term support. Through successive acquisitions, "Netscape Enterprise Server" was rebranded multiple times and merged with other technologies, which explains why LiveWire's documentation can be found on Oracle's website.

It is a bit difficult to trace exactly how LiveWire evolved in that context, and figure out when exactly it was discontinued.

Its legacy is an interesting one: while it is not hard to find comments on the internet about how seemingly hard and unpleasant it was to work with this technology (1) (2) (3), it remains an important piece of JavaScript's history, as it was one of the very first attempts at making the language live outside the browser and compete on the "for business" market of software development solutions.

Latest comments (4)

Collapse
 
ievolved profile image
Shawn Bullock • Edited

I was fascinated by Javascript in the days of Netscape 2/3/4 and I remember LiveWire quite well. It was nothing like NodeJS but it was the first I attempted to go all in with Javascript. They didn't even have JSON back then -- something I can't live without today and I miss (its Javascript language variant) so much when I go into other languages. Early JS was a quirky language. Looking at it through the lens of today there's no wonder it didn't succeed. But through the lens of the day, the future was so bright.

Collapse
 
mjgardner profile image
Mark Gardner

Thanks for writing about this. It seems like more and more of early web development, especially blind alleys like LiveWire, has been tossed down the memory hole. Newer developers claim to be the first to invent things when they’ve only been rediscovered and popularized. It’s important to recognize the true innovators.

Collapse
 
tahmid_rahman profile image
Tahmid Rahman

Very Informative Article ...Thanks

Collapse
 
urielsouza29 profile image
Uriel dos Santos Souza

Good