Chapter 20

The Future of JavaScript


CONTENTS

Welcome to the final chapter! If you've made it this far, you should be approaching JavaScript Expert status. For this chapter, you'll take a look at what the future may bring for Netscape and JavaScript. You'll look at new features that are planned and those that would sure be nice. Finally, you'll examine some of the alternatives to JavaScript-both present and future.

Planned New Features

Although Netscape hasn't made any formal announcements, the developers have mentioned some upcoming fixes and improvements to the language. At this writing, Netscape 3.0 is nearly final; most of the new features will have to wait for version 4.0.

Here are some of the improvements you can expect to see in future releases:

Aside from JavaScript, Netscape 4.0 is expected to include many new features. By the time you read this, a beta version will probably be available. Here are some of the likely features:

LiveConnect

You learned about LiveConnect in Chapter 13, "Working with Multimedia and Plug-Ins," and Chapter 16, "Integrating JavaScript with Java." This is the recently introduced feature that enables integration between JavaScript, Java, and Netscape plug-ins.

Although LiveConnect is already available, I'm considering it part of the future because it isn't well-supported yet. Once it is, you'll be able to enjoy the following benefits:

A JavaScript Wish List

It's impossible to know exactly which features will be added to JavaScript in the future. For that matter, with the ephemeral nature of the Internet, it's impossible to know whether JavaScript will become a completely different language or be replaced with something else.

Rather than try to predict the future-an impossible task in a constantly changing industry-I'll focus on the things that I would like to see changed in JavaScript (and Netscape's implementation of it) in the future. The next sections outline a wish list of changes for which we can all hope.

Language Features

As noted in this book, the JavaScript language is limited in many ways. Although its simplicity is one of its greatest advantages, it can be difficult to create complex programs. Here are a few language features that would make JavaScript an even better language:

Interactive Forms

As noted previously, Netscape intends to add the capability of enabling and disabling form elements. It would also be nice if you could modify a form after it was loaded-for example, changing the width of a text field. Another interesting feature would be the capability of modifying event handlers of form elements "on the fly."

Graphics and Multimedia

As you learned in Chapter 12, "Working with Graphics in JavaScript," the dynamic image feature made JavaScript truly useful for graphic applications-but it could be better. For example, images of different sizes could be supported. An object to handle sounds would also be very useful.

User Interfaces and Frames

Frames provide for some complicated JavaScript programs, and the new floating frames will make things that much more complicated. Anything to simplify working with frames would be an improvement. In addition, there is currently no way to read or change the values of JavaScript variables in another frame.

Java and Plug-Ins

As mentioned previously, LiveConnect would be very useful if supported by more Java applet and plug-in developers, and this is bound to happen in the near future. It would also be very helpful if JavaScript could dynamically load and unload Java applets, similar to the dynamic images feature.

New Applications for JavaScript

Currently, JavaScript is something of a novelty on the Web-by far, the most common use is to scroll a message. I believe that more serious applications will become more common in the future:

JavaScript Development Environments

Another possibility in JavaScript's future is dedicated development environments. Currently, several tools for creating Java applets are available, but none dedicated to JavaScript.

A JavaScript integrated development environment (IDE) would enable you to use drag-and-drop tools to create a complex JavaScript application, without much actual programming. This may become especially useful as hybrid Java/JavaScript applications become more common.

A step in the right direction is that several of the available HTML editors now include features for inserting JavaScript tags (event handlers and the <SCRIPT> tag). Netscape's Navigator Gold is a WYSIWYG editor, and also enables you to use JavaScript.

Alternatives to JavaScript

Finally, let's take a quick look at the Web languages that are currently giving JavaScript a run for its money-or can be used along with it.

Java

Java was the first of the client-side Web languages, and is still among the most powerful. You looked at Java in detail in Chapter 16 and explored ways of integrating it with JavaScript.

Java has become widely accepted on the Web-more so than JavaScript, as a matter of fact. There are already over a thousand publicly available Java applets, and more are being developed constantly.

Java is a bit ahead of JavaScript, and it has already moved beyond the novelty stage. Although clocks, animations, and LED signs are still common Java applets, more and more sites are using it for interactive applications, games, and custom business-oriented applications for business intranets.

Microsoft has committed to supporting Java. It's already supported in the latest beta of Microsoft Internet Explorer, and rumor has it that Java will be involved in a big way in the next release of Windows.

Microsoft's concern is probably in response to the possibility of Network Computers (ncs)-dedicated consumer machines that use an Internet connection to access software and use Java as an operating system. ncs haven't become popular yet, but Java seems to be here to stay.

CGI

CGI was the first taste of interactivity for the Web. Despite the growth of Java, JavaScript, and plug-ins, CGI is doubtless still the most common type of program in use on the Web.

Any time you fill out a registration form, make an order, or answer a question on most Web pages, a CGI script is used. Some sites use CGI to read all pages from a database, so every page you read comes from CGI.

CGI is also one of the few parts of the Web that doesn't seem to be changing much. The CGI specification is much the same today as it was two or three years ago-and on the Internet, that's a very long time.

Some current CGI applications are being replaced with Java versions because it can communicate with the server and is more interactive; however, CGI will probably remain for a long time yet.

SSI

Server-side includes (SSI) is a way of embedding a CGI program directly in a Web page. Although less commonly used on the Web, it still provides features available in no other language.

SSI is often used to add counters and dynamic information to pages, and it is used on some servers as a simple way of including the same text-for example, a copyright notice-on a Web page.

LiveWire: Server-Side JavaScript

You may not have heard of LiveWire, but it's a close relative of JavaScript. It was released by Netscape about the same time as the first version of JavaScript. (At the time, JavaScript was called LiveScript, so the names were similar.)

LiveWire has a similar syntax to JavaScript, but it is executed on the server instead of the client. This gives it many of the advantages of CGI and SSI. It can also communicate with client-side JavaScript, giving you the best of both worlds.

Sounds too good to be true? Well, it may be. There is one disadvantage of LiveWire-it works only on Netscape's Web server software. Because the majority of Web sites are run using the free servers-for example, Apache and ncSA httpd-LiveWire has had severe growing pains.

It is unknown whether Netscape will enable LiveWire to be supported on other server platforms, or whether anyone will attempt to do so; until then, it may be a useful tool if you happen to have a Netscape server.

Shockwave

Shockwave was one of the first plug-ins available for Netscape Navigator. It enables Director movies and animations to be displayed inline in a Web page, and it enables some measure of interactivity.

The Shockwave plug-in is available at no charge from MacroMedia. However, to create content for Shockwave, you need to use MacroMedia Director, which is not available for free. This has prevented Shockwave from being widespread, but there are already a wide variety of Shockwave sites available-and more are coming.

One reason sites avoid Shockwave, and other plug-in-based additions to the Web, is the concern that not all users will download the plug-in. Netscape has considered making plug-ins download automatically-something like ActiveX controls in MSIE-and this may solve the problem. In addition, future versions of Netscape may be bundled with plug-ins.

ActiveX

ActiveX controls (previously known as OLE or OCX controls) are Microsoft's answer to dynamic Web content. These controls can be embedded in a Web page and add capabilities to the page-ranging from scrolling text to an entire spreadsheet.

The popularity of ActiveX in the future will depend on the popularity of MSIE, currently the only browser that supports these controls. In addition, a plug-in for Netscape, ncompass, supports ActiveX. Currently, Netscape does not plan to add ActiveX capabilities to Navigator directly.

Note
One limitation of ActiveX is that it works only on Windows platforms. This limits the audience and may prevent it from becoming widely accepted.

VBScript

VBScript is the only currently available Web language that fits into the same niche as JavaScript. VBScript is implemented by MSIE, and it includes many of the same features of JavaScript. It's a simpler language and may be easier for beginners to understand.

Again, the popularity of VBScript will depend on the popularity of MSIE. However, MSIE already supports JavaScript, so users may simply keep using a language with which they're already familiar. On the other hand, Netscape may be adding support for VBScript in a future version.

Note
Currently, VBScript is supported only by MSIE. Netscape does not currently intend to support it. However, if MSIE becomes widespread, it may be forced to.

HTML Enhancements

If some uses of JavaScript become obsolete, it may not be another language that takes them over-additions to HTML itself may eliminate the need for JavaScript. Here are a few examples:

As HTML improves, though, JavaScript will also improve-I'm confident that there will always be a use for it in Web pages. (But will there always be Web pages? That's another story.)

Workshop Wrap-Up

In this chapter, you took a look at the future of JavaScript:

Next Steps

If you've read this book in order, you've reached the end of the line. If not, you can learn more with the following:

Q&A

Q:
Why did Microsoft implement JavaScript in its Web browser, if it wants VBScript to become a popular scripting language?
A:
Microsoft needs people to accept MSIE as an alternative Web browser, and to do that it needs to support the latest Web features-JavaScript being one of them. Also, the ActiveX features of MSIE 3.0 make it easy to support a variety of scripting languages.
Q:
Will ActiveX controls ever be available on anything but Windows platforms?
A:
Doubtful, because they rely heavily on the Windows API. If they were implemented on other platforms, they would probably be slower and require large amounts of memory.
Q:
Is every Web language listed in this chapter?
A:
I've tried to list the most popular and controversial languages-those that are driving the future of the Web. However, there are always others. For example, there are well over a hundred plug-ins besides Shockwave that enable different types of interactive content.

Conclusion

I hope you've enjoyed this book, and that you're as excited as I am about the many possibilities for JavaScript. You're probably already thinking of some new ideas for JavaScript programs.

To keep up with JavaScript, you'll need to keep an ear to the ground, because the language is still changing. appendix C lists some online resources that may be helpful-in addition, be sure to watch the Web site listed in the Introduction for updates, additions, and more examples.

If you create something new and exciting, I'd like to see it. Contact me at the address listed in the introduction. I'll also try to answer any questions about this book you may have.

I wish you well in your future tasks with JavaScript and other languages, and may all of your JavaScript programs be bug-free. (Or at least, may you not give up until they are.) Good luck!