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.
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:
- Event handlers will be able to include arguments. One useful
example will be the capability of receiving x and y values from
image maps.
- You'll be able to enable and disable elements within a form-and
possibly, add new ones.
- A wider variety of events will be available for JavaScript.
- Most importantly, bugs will be fixed. Once Netscape 3.0 is
stable, you can expect JavaScript to increase in popularity as
features such as dynamic images become widespread on the Web.
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:
- Support for HTML style sheets. These will enable you to specify
exact spacings, fonts, and layout for HTML elements, while staying
compatible with older browsers.
- Special features to enable collaboration between users, especially
in corporate intranets.
- Frames will be improved to include "floating" frames,
which can overlap each other and don't always include borders
or scrollbars.
- Some basic form validation capabilities and automatic computations
will be added as HTML attributes-without necessarily using JavaScript.
- Netscape's e-mail program will include MIME support and support
for secure, encrypted e-mail.
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 wide variety of public-domain Java applets will be available,
which include public methods that can be accessed with JavaScript.
- With any luck, plug-in authors will begin to widely support
LiveConnect. This will enable you to use JavaScript to manipulate
and control new types of data-3D objects, VRML, video, real-time
audio, and many more.
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.
As noted in this guide, 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:
- Objects could be improved with a truly object-oriented implementation-for
example, an object could be defined as based on another object
and automatically inherit its characteristics.
- As noted in Chapter 14, "Debugging JavaScript Programs,"
JavaScript's error messages can be downright infuriating at times.
It would be nice to have a JavaScript debugger of some sort-or
at least some more accurate error messages.
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."
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.
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.
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.
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 can be used for form validation, but few sites
currently do so. Validated forms will become more common as the
general public starts to accept JavaScript as part of the Web.
- There are a few good JavaScript games-recall the one in Chapter
15, "Real-Life Examples III"-but I believe the potential
for games in JavaScript is largely untapped. Hopefully, as features
such as dynamic images become common knowledge, more complex games
will be developed.
- MSIE supports ActiveX, and Netscape can support it with the
ncompass plug-in (see appendix C). JavaScript can be used to add
scripting and control to ActiveX controls, and this use will increase
in the future-especially if MSIE turns out to be serious competition
for Netscape Navigator.
- As LiveConnect becomes more widely supported, JavaScript will
become a tool for manipulating Java applets and plug-ins dynamically.
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.
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 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 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.
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 notice-on a Web page.
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 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 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 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.
|
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:
- Netscape intends to add simple form validation as an extension
to HTML in a future version.
- Tricks now implemented by JavaScript, such as scrolling messages,
may be built directly into HTML in the future.
- Style sheets, which will be supported in Netscape 4.0 and
are already supported by MSIE, will give both designers and users
control over a page's appearance, eliminating some needs for JavaScript
(such as deciding whether to display a frame version).
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.)
In this chapter, you took a look at the future of JavaScript:
- Features Netscape might add to JavaScript in the future, and
to its Web browser
- A wish list of features that could make JavaScript more useful
and powerful
- A look at the other languages on the Web, and how they might
affect JavaScript's popularity in the future
If you've read this guide in order, you've reached the end of the
line. If not, you can learn more with the following:
- To learn about Java and how it can be integrated with JavaScript,
see Chapter 16, "Integrating JavaScript with Java."
- To learn about CGI and SSI, turn to Chapter 17, "Combining
JavaScript, CGI, and SSI."
- To learn more about ActiveX, VBScript, and MSIE, turn to Chapter
18, "Using ActiveX and Microsoft Internet Explorer."
- To see examples of integrating JavaScript with other Web languages,
see Chapter 19, "Real-Life Examples IV."
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.
|
I hope you've enjoyed this guide, 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 guide 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!
|