Ask HN: Why didn't the early web support more client side languages?
Disclaimer: I'm a backender so I may have this all wrong :)
The script element in HTML has provided the language property since its introduction, though nowadays it is deprecated in favour of the type attribute.
But the browser-supported languages seems to have been almost entirely Javascript and VBScript.
Given that Javascript is considered to be an at best quirky [0] language (justifiably given its 10 day gestation) how come the browser ecosystem never expanded to accommodate more direct scripting languages - particularly in the early days when Javascript libraries were rare beasts? As I remember it Javascript was deeply unpopular with devs until libraries like JQuery came along to make things a little less painful.
Was it the baleful influence of IE6 or some other winner-takes-all effect or what?
69 comments
[ 3.4 ms ] story [ 148 ms ] threadIn a desktop environment you can have many languages that compile to the same machine code. You can compile interpreters that run in that machine code.
If browsers had to support ten languages then they would be ten times as complicated. You'd not just have quriks and bugs in Javascript but quirks and bugs in the other languages to worry about.
Today with WebAssembly you could compile any language you want for one runtime, though people have done that with transcoding to Javascript for a long long time.
At the peak of the browser wars I'd have expected this to be something tried to get mindshare (or maybe it was and didn't work well enough that I ever heard about it?)
Edit: E.g. HTML 4 spec (at least) offers text/tcl as a plausible language value. Did anyone ever offer that? Surely someone must have supported text/lisp as well at least briefly :)
Then came Microsoft's ever-so-slightly incompatible Jscript, and the next ten years of web history was a fight to see who could lock the most web developers in the trunk.
No room for alternative languages in that scenario.
Cross platform support across many vendors has always been hard. Look at cross platform libraries in C. Different compilers, OS, and std library implementations. Python or Ruby on the other hand have one “vendor” that works to make the runtime consistent on different platforms.
So for something like Python or Ruby to work well, it’d need to either be:
1. A central vendor driving development, who would need to manage and install a runtime on your computer
Or
2. All browser vendors have to buy into a single spec and make a very consistent implementation across their browsers.
Or
3. Compile to JavaScript (or web asm etc)
For (2) browser vendors already invest heavily in JavaScript and have a hard time keeping up! For (1) I’m not sure why any language vendor cares to try to compete with JavaScript seriously. The browser is quite different environment than the CLI or Desktop that it’d be a significant investment without clear upside.
We do see (3) with Typescript and Coffeescript. These create some debugging friction. Also as JavaScript gets marginally better the appeal of these other languages can feel more niche, and many people just use the common denominator.
They did, actually:
https://perlhelp.web.cern.ch/Components/Windows/PerlScript.h...
If you installed ActivePerl, you could use, in IE 5.0,
I even remember using this for shits and giggles. And then I noticed noone else was willing to install it, and gave up on it.(Don't get confused by the server-side bits, those are for IIS, this stuff did both server-side and client-side...)
[Ed.add.: also I don't think Netscape ever supported anything other than JavaScript, but I'm not sure of that.]
I, too, had dreams of using the client-side version, but getting folks to install it was indeed much too tough of a sell.
And ClojureScript, and PureScript, and Elm, etc
Honestly, in my hobbyist experience, JavaScript is a joy to use as a compilation target. All the flexibility and the laundry list of features which can make it a handful to use directly, make it a wonderful base for nearly any kind of language you can imagine. And because it's higher-level, you can focus your energy on your own language instead of on re-implementing the fundamentals from scratch. And then of course it performs better than most similarly-flexible languages, and runs anywhere.
Depends on what you're trying to do. My language projects are almost always higher-level and garbage-collected, so again, targeting WASM would mean re-implementing fundamentals from scratch all the time. I'm glad to focus instead on interesting language features, translating those to be in terms of JS features.
I have no idea with Coffeescript (I've read about it, but never used it). But my current job is basically spent all day writing TypeScript.
1) There is no debugging friction. I can debug TypeScript directly in my browser.
2) It isn't marginally better over JavaScript. It is leaps and bounds better than JavaScript.
TypeScript compiler will catch many, many, many common problems straight away (provided it is configured correctly). I have written a lot of JavaScript and I don't enjoy going back to having to write regular JavaScript.
If someone else is handling that work for you (and in most companies this does essentially become a core responsibility for a few critical maintainers) then yes - Typescript feels great.
If you have a small, single person project - there's enough real overhead there that I'm not sure typescript is the right initial choice.
You can literally do:
And you will have a javascript file that you can run in a browser. No configuration files needed, just need to install the typescript compiler. Sure if you need more complicated things. You will need a more complicated setup. But it is no worse (and in someways better) than most of the ecosystem.> If someone else is handling that work for you (and in most companies this does essentially become a core responsibility for a few critical maintainers) then yes - Typescript feels great.
I don't know where you work. However I've done this myself by myself. It is well documented and it isn't that difficult. I think the hardest to setup from scratch is webpack, but Gulp is fairly straightforward.
I've have set stuff up completely from scratch and created my own framework with TypeScript (I was bored during lockdown) and it takes maybe a day to figure out with webpack.
Not something for a beginner. However you don't need a whole team to do this or specific people looking after it.
> If you have a small, single person project - there's enough real overhead there that I'm not sure typescript is the right initial choice.
The same could be said of any other language where you need any sort of build system and a compiler.
In this regard, javascript was itself being pulled from different sides at the same time as well. The surprising thing, in my opinion, is that it managed to get in one piece after all.
Of course, Google tried with Dart, but that never went anywhere.
FWIW I recall only being able to use VBScript in IE (maybe there was a way to run ActiveX components in other browsers?)
I want to say tho, that many (most?) MS Active Scripting languages could run as client scripts, at least I recall Perl ones running in a browser context through ActivePerl.
And yeah I used PerlScript (ActivePerl) in some hacks, but you had to install that separately which pretty much killed it.
[citation needed]
Having lived through that period of time, I do not recall Java applets and JavaScript ever being considered to be in the same category / trying to solve similar problems.
https://auth0.com/blog/a-brief-history-of-javascript/
My guess is, applets were crashy for different reasons than CPU speed.
Not in the least - The early scripting language Mocha, was first renamed to LiveScript then Netscape and Sun did a license agreement and it became JavaScript. And the idea was to make it a complementary scripting language to go with Java, with the compiled language.
Purely marketing, to attempt to use the popularity of stand-alone Java for an in-browser scripting solution.
https://en.wikipedia.org/wiki/ActiveX
> Microsoft dropped ActiveX support from the Windows Store edition of Internet Explorer 10 in Windows 8. In 2015, Microsoft released Microsoft Edge, the replacement for Internet Explorer with no support for ActiveX, this event marked the end of ActiveX technology in Microsoft's web browser development.
[1] https://developer.mozilla.org/en-US/docs/Web/API/Document_Ob...
These were the days when Microsoft was M$, and it might be hard to remember just how anti open source they were. There was just _no way_ M$ was going to support a new (or existing) open source language in IE unless they were forced.
And none of the niches that loved those languages had any interest in working with M$ to "embrace and extend" their language of choice, so it's not like there was a lot of cooperation out there.
The moment "does it run on IE?" became uppermost in developers minds was (as I see it) the moment the original browser wars ended and the long cold war began. But there was a cambrian explosion of often-incompatible features before that.
Edit: I definitely buy that as the reason that IE didn't adopt any other languages, though, and maybe there just wasn't time for Netscape to bolt another one on? Or maybe their great rewrite got in the way (I'm hazy about the timeline for that).
And it definitely wasn't certain at the time that a scripting language, running in the browser, was going to be The Future.
Not a great strategy when your competitor have much more resources than you have yourself. Microsoft could quickly reverse-engineer any Netscape feature, and Netscape had limited resources. Any wasteful drain on Netscapes resources would just have played into Microsofts hands.
So, while I certainly can't make any statement on what was in people's heads at the time — I'm pretty sure trying to integrate a new scripting language into either of those two would've been a daunting task. And both of these vendors would have had some interest in making you not succeed. (MS pushing VBScript [later JScript], and Netscape had some major involvement in JavaScript AFAIR.)
…oh and presumably your additional language wouldn't come included with the browser, and not having to install additional shit was kinda the entire point of JavaScript…
http://www.tcl.tk/software/plugin/
Then we settled for PHP somehow :/
Followed by the drupal era.
What still amazes me is that Javascript has had this powerful functional programming capability this whole time and our industry has only recently learned/learning to use it.
"There are only two kinds of programming languages: those people always complain about, and those nobody uses." -- Bjarne Stroustrup
A scheme-line language would have been cool though, and great as a compilation target.
God, I hate this meme.
It was originally intended as a simple scripting language to add interactivity to browsers, so the initial implementation was quick and dirty, but the language has evolved a lot since then. The "10 day gestation" has nothing to do with the quality of the language.
He calls the language "quirky at best". Lots of people find it expressive and powerful, and those quirks are easy to ignore. For example, == is terrible, but we have === now. In 5 years of professional JS development, I've never seen anybody use the former.
I guess some of my dislike of Javascript leaked in. But for the most part this is about the early days of the language when its quirks were more glaring as the mitigations and improvements hadn't been discovered/created.
My personal feelings about it are more a general distaste for dynamically typed stuff. I rarely had to tangle with it professionally and cheerfully admit my ignorance of best practices!
Google briefly tried to make client-side Dart a thing, but nobody* ever used Dart at all, for anything.
*statistically...
This. Then Steve Jobs killed Flash.
https://web.archive.org/web/20100502021750/https://www.apple...
It was ugly. It had terrible looking widgets that were out of place on Windows, Macs, AND Unix boxes - quite a feat at that.
One (dumb) thing JavaScript had going for it was that at least initially, you had to have it on to get CSS action on pages in Netscape. If you turned off JS, then you lost CSS too and things probably looked pretty ugly.
I want to say that some browsers forced you to keep JS on in order to parse a proxy.pac and those of us in corporate/educational environments with filtering proxies had to deal with that, too. Add it to the CSS issue and now you have multiple reasons to leave it on and try working with it. By way of comparison, you could get by with Java disabled.
I still ran with both off in the bad old days and took the lumps, but I'm just cranky that way. I still run with JS off by default.
Bizarrely, this was because CSS was implemented on top of JavaScript in Netscape. Netscape was initially not a fan of CSS and developed their own JavaScript-based style sheets. Then at some point they decided to support CSS anyway, and implemented it by transforming the CSS to JavaScript style sheets. This architecture was allegedly the reason for the incredibly buggy support for CSS in Netscape.
To be successful a client side language had to be multiplatform / multibrowser from the start and none of the alternatives were. IBM tried putting Rexx in WebExplorer (I don't even know if that version escaped from IBM internal use). I vaguely recall some sort of extension on whatever shipped on the SGI Indy in 1996 but I don't remember if that was just SGI implementation of JavaScript with Indy enhancements or something entirely different.
Doing anything more sophisticated than simple dhtml menus or form validation was just impractical until broadband became more widespread around 2001-2002. There's a reason web 2.0 happened when it did, it wasn't just the enhancements to JavaScript & the DOM & browsers but the average user started to have access to 1Mbps DSL and cable modems.
So what happened? Given that we lived through an era of Internet Explorer dominance, and Windows/IE was apparently shipping with a variety of scripting languages built in, how did that not lead to options for client-side scripts? (This all took place before my career change into programming, so I didn't really notice as I was living through it – sorry if that results in some ignorant questions).
VBScript was the only viable contender, but it never really had any compelling advantages compared to JavaScript. JavaScript is often criticized for quirky design and syntax, but if anything VBScript was worse.
Also the pluggable script engines were based on COM, so only worked on Windows. I don't think VBScript was ever supported in IE for Mac.
I don't think Microsoft ever saw a strategic advantage to promoting alternative languages on the web. Otherwise they would have done a lot more.
Netscape/Mozilla always lacked resources compared to the competitors Microsoft and Google which have much deeper pockets. Supporting more languages would be a waste of resources from their perspective. They believed in fixing and improving JavaScript rather than adding another language.
Microsoft did support VBScript as an alternative, and at one point they had such a dominant market share they probably could have pushed VBScript as a viable JavaScript alternative e.g by adding cool features only to VBScript. But MS instead decided to stop developing the browser at that point.
Google invested heavily in their optimizing JavaScript engine to make the web more viable as an application platform. Again this means they didn't have any interest in adding a second language since they would have to make the same investment once more for no benefit.
It is true that JavaScript was not well liked. But the frustration was primarily around incompatibilities in the DOM API and browser-specific bugs. Adding a second language would not solve any of that, it would just double the amount of incompatibilities and bugs.