"Is JavaScript's predominance a historical accident or something else?"
I am personally of the opinion that JS's success is a matter of design as much as many have been and will continue to be loathe to admit it and not just some accident or merely due to the fact that it was the first kid on the playground.
Though named so as to appeal to Java developers and syntaxed like Java's C-based syntax also to appeal to Java developers, Brendan Eich made one of the most badass decisions in the history of the www which was to draw primarily from Scheme for actual language mechanics inspiration, which is something Java developers don't appear to have liked very much at all (which I find highly amusing).
JavaScript uses highly flexible/granular prototypal inheritance for OOP, it has closures, types are 100% dynamic, functions themselves are first-class allowing them to be passed around like any other object or data type and get re-used in different contexts and even get applied to objects on the fly as if they had been declared as actual object members from the start. It is practically screaming to be used for event-driven architectures that need to normalize a ton of proprietary garbage or handle highly non-linear UI problems.
At the end of the dawn of the web it is the only language that has ever been seriously up to the task of normalizing browsers through an actual browser war where Netscape and IE tried to do things differently on purpose, followed by 10+ years of browser truce where IE just did things differently because MS is lazy and self-entrenched into some righteously stupid anti-competitive practices resulting in browser stagnancy, and now a world where the browsers are finally starting to agree on the same general spec in regards to HTML, CSS and the DOM API with IE merely being 2-3 years behind the latest developments rather than 10 owing to Google and Mozilla busting out JIT compilers that made IE's performance numbers look so pathetic MS was finally shamed into properly modernizing their damn browsers. IE9 is the first to actually seriously upgrade the DOM API support to levels that Netscape was supporting back in 2000ish.
JS has had competition in the form of Java Applets and Adobe's ActionScript for Flash. That's about it on the serious contender front. MS tried to push VB but failed miserably because... well... VB. Also, proprietary. There were actually a lot more Flash sites than most people realize. You just couldn't find the silly things with search engines. Applets did their own thing, and it was ugly. Real ugly. JS was the only language that really tackled the problem of working within the context of multiple browsers by people who didn't agree on who was setting the specs they were supposed to be matching up with.
In recent years JS has been exploding into a much wider domain of application. In combination with other web technologies it is geared up to basically knock all other solutions over on the mobile front since it + web technology is really the only realistic choice right now if you really do want to write one app and have it work on everything.
So no, and yes I'm a big fan, but I don't think it clobbered all other contenders on the client-side by accident any more than it becoming explosively popular outside of the browser could be considered an accident now. Before JS, there weren't many Scheme-like languages out there that weren't primarily academic. That's given JS some powerful advantages and the unique needs of the client-side made it possible for those advantages to slowly become crystal clear.
vote to close
if you feel this is off-topic. If others feel the same way, either they, or a moderator, will follow your lead.