WebTV JavaScript Guide

August 17, 1999

In order to help developers create scripts that run on all platforms, the WebTV browser attempts to be compatible with Netscape's, Microsoft's, and ECMA's versions of JavaScript. However, full compatibility with all the standards is impossible due to the small amount of memory in the original WebTV-based systems. This guide will outline key differences due both to features of the WebTV browser, and bugs that are not yet fixed.

Unimplemented Functionality

The WebTV browser does not implement the following JavaScript functionality:

  • Multiple windows - Since the WebTV browser does not support multiple windows, scripts cannot open windows and subsequently read from or write to those windows. An exception is made, however, for windows larger than 400 by 300 pixels, which are treated as a new page. The user can get back to the original window by pressing the "back" button.

    The lack of multiple windows has caused problems for authors who use the window object to refer to frames. For instance,


    would not work on a WebTV browser. Instead, consider using:

    parent.frames[0].location = 'ft-top.html';
    parent.frames[1].location = 'ft-left.html';

  • Regular expressions - For example: var re = /a|b|c/i
  • Signed scripts - Scripts digitally signed for security are not supported.
  • Adding values to built-in objects - For example, document.myVar.color is not supported; use myVar.color instead.
  • Numeric sort - The array.sort method in JavaScript does not support the optional function parameter to customize the sort order. If you need to do a numeric sort, we recommend using a simple "bubble sort" function like the one below. Please note that this type of sort may not be efficient for large arrays.

function bubbleSort(arrayName,arrayLength)
    for (var i=0; i<(length-1); i++)
    for (var j=i+1; j<length; j++)
    if (arrayName[j] < arrayName[i])
       var dummy = arrayName[i];
       arrayName[i] = arrayName[j];
       arrayName[j] = dummy;

The WebTV browser implements the following items differently than you may expect:
  • Arrays - The WebTV browser limits arrays to 32,768 elements.
  • Errors - The WebTV browser does not alert users when a Web page contains JavaScript errors, although serious errors will disable JavaScript on a given page.
  • Math - The WebTV browser uses 32 bit floats instead of 64-bit doubles. This is adequate for all but high-end mathematical computations.

Unimplemented Functions and Event Handlers

WebTV does not implement certain JavaScript functions, including:

object.prototype(), document.domain, form.encoding, history.next, window.onError(), and window.onUnload()

window.opener - WebTV supports read-only for window.opener rather than read/write.

The following event handlers are not supported:

onAbort, onError, onUnload, keyDown, keyUp, keyPress, mouseDown, mouseMove


While WebTV Networks is always improving the WebTV browser, certain bugs will exist at any given time. Because WebTV Networks does not roll out patches, but rather whole new versions of the WebTV browser, some bugs may take months to fix. We hope listing the bugs and workarounds here will help you in the meantime.

Form elements cannot be accessed without specifying the "document" object before them. This is not a bug according to the JavaScript specification,  because object properties must be prefaced by all object ancestors. WebTV Networks is investigating whether to change this behavior in future browsers.


if (CustForm.First_Name.value.indexOf("Foo") !=  -1)

Always include the explicit object hierarchy when referring to objects, e.g.

The WebTV browser thinks it's Netscape. When presented with the conditional
if (navigator.appname == "Netscape"), current WebTV clients will return true.


if (navigator.appname == "Netscape")
alert("Hey, what are you doing here, WebTV?");

When doing a browser sniff, check for WebTV browsers before checking for Netscape browsers.

onClick event handler does not always work as expected when placed in a hyperlink. When a user clicks on a hyperlink that has an onClick, the event will occur, but the link will not be followed.


<a href="www.odwalla.com" onClick="alert('You can't go there.')">Odwalla</a>

In some cases, you can get around the problem by defining statements in a function, then calling that function from the link. In other cases, WebTV users may have to click a link twice.


Here are some Web sites that we find particularly useful when developing JavaScript:

  • Devhead - A great all-around site for JavaScript, including news, tutorials, and reviews.
  • Webcoder - Notable for its "scriptorium" and JavaScript compatibility charts.
  • Irt.org - Probably the most exhaustive list of JavaScript FAQs around.
  • Deja.com - When all seems lost, turn to the Deja.com Power Search. Type "*javascript*" into the forum field, and you can search all JavaScript newsgroups for a particular word or phrase.