Programming Windows: Hello, VBScript (Premium)

Microsoft created VBScript as a simpler alternative to JavaScript that was based on its vast experience with the BASIC programming language. The scripting language had little success in the browser since it was only supported by Internet Explorer. But with the software giant also creating its own web server and bringing its COM technologies online as ActiveX, VBScript played an important role in “activating the Internet.”

We’ve already looked at client-side scripting---that is, scripts that in a web page that are executed by the browser---in Programming Windows: Hello, HTML (Premium) and Programming Windows: Hello, JavaScript (Premium). In both cases, the scripting language was JavaScript, which was and still is broadly supported in all web browsers. JavaScript is a standard and the lingua franca of the web, and it is inarguably the single most popular programming language in the world.

But in 1996, Microsoft was still pushing to embrace the Internet across all of its product lines, and it embraced and extended JavaScript in two ways, with its own version called Jscript, which was largely compatible with the original language, and with VBScript, which was based on a version of the Visual Basic language called Visual Basic for Applications (VBA).

As you may recall, one could write a simple hello, world script in JavaScript (or JScript) and HTML like so:
<HTML>
<HEAD>
    <TITLE>Hello, JavaScript!</TITLE>
</HEAD>
<BODY>
<SCRIPT>
    document.write("<H1>Hello, JavaScript!</H1>");
    document.write("<P>JavaScript is the glue that makes the web work.</P>");
</SCRIPT>
</BODY>
</HTML>
A version in VBScript would look very similar.
<HTML>
<HEAD>
    <TITLE>Hello, VBScript!</TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE="VBScript">
    document.write("<H1>Hello, VBScript!</H1>")
    document.write("<P>VBScript is a Microsoft alternative to JavaScript.</P>")
</SCRIPT>
</BODY>
</HTML>
The only real difference in the code is the addition of the VBScript language attribute in the <SCRIPT> tag and the removal of the semicolons, since VBScript, like VB and VBA, didn’t require line endings. And sure enough, it works identically to the JavaScript version.

OK, that’s not very interesting, I know. And it was even less interesting in the 1990s because, again, client-side VBScript didn’t work in Netscape Navigator, which was by far the most popular web browser. In fact, Navigator would simply ignore VBScript, so the page above would render as blank.

Because of this limitation, few web developers ever embraced VBScript for client-side scripting. And even when Internet Explorer overtook Navigator in usage, it made sense to stick with JavaScript, which worked in all browsers.

One issue with client-side scripting, of course,...

Gain unlimited access to Premium articles.

With technology shaping our everyday lives, how could we not dig deeper?

Thurrott Premium delivers an honest and thorough perspective about the technologies we use and rely on everyday. Discover deeper content as a Premium member.

Tagged with

Share post

Please check our Community Guidelines before commenting

Windows Intelligence In Your Inbox

Sign up for our new free newsletter to get three time-saving tips each Friday

"*" indicates required fields

This field is for validation purposes and should be left unchanged.

Thurrott © 2024 Thurrott LLC