Global object (Object/core)

A special type of object that is always available in the prototype chain.

Availability:

ECMAScript edition - 2
JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.0
Netscape - 2.0
JavaScript syntax:-myGlobal = document.parentWindow
-myGlobal = frame
-myGlobal = self
-myGlobal = window
-myGlobal = window.frames[anIndex]
Argument list:anIndexA reference to a window object which is also a global object for that window
Object properties:clientInformation, clipboardData, closed, crypto, defaultStatus, dialogArguments, dialogHeight, dialogLeft, dialogTop, dialogWidth, document, event, external, frame, frameRate, history, innerHeight, innerWidth, java, length, location, locationbar, Math, menubar, name, navigator, netscape, offScreenBuffering, opener, outerHeight, outerWidth, Packages, pageXOffset, pageYOffset, parent, personalbar, pkcs11, returnValue, screen, screenLeft, screenTop, screenX, screenY, scrollbars, secure, self, status, statusbar, sun, toolbar, top, window
Class constants:Infinity, NaN, undefined
Object methods:addClient(), addResponseHeader(), alert(), Array(), attachEvent(), back(), blob(), blur(), Boolean(), callC(), clearInterval(), clearTimeout(), close(), confirm(), Date(), debug(), deleteResponseHeader(), detachEvent(), disableExternalCapture(), enableExternalCapture(), escape(), eval(), execScript(), find(), flush, focus(), forward(), Function(), getOptionValue(), getOptionValueCount(), home(), isFinite(), isNaN(), moveBy(), moveTo(), navigate(), Number(), Object(), open(), parseFloat(), parseInt(), print(), prompt(), redirect, registerCFunction(), resizeBy(), resizeTo(), scroll(), scrollBy(), scrollTo(), setHotkeys(), setInterval(), setResizable(), setTimeout(), setZOptions(), showHelp(), showModalDialog(), showModelessDialog(), ssjs_generateClientID(), ssjs_getCGIVariable(), ssjs_getClientID(), stop(), String(), typeof(), unescape(), write()
Functions:atob(), btoa(), captureEvents(), handleEvent(), releaseEvents(), routeEvent()
Event handlers:onAfterPrint, onBeforePrint, onBeforeUnload, onBlur, onDragDrop, onError, onFocus, onHelp, onLoad, onMove, onResize, onUnload
Collections:frames[]

The Global object is unique and is created before any code is executed. In an ECMAScript compliant implementation it is where variables, methods, functions and properties are stored if you don't explicitly attach them to another object yourself. The member properties, methods, functions, and variables are globally available because the Global object is placed into the scope chain of every execution context.

In a web browser, the Global object is also the Window object. In a server-side implementation, the Global object is probably the Response object but this is not mandatory. Other implementations will one of the host objects as the Global object but there is no defined and standard choice.

Since you don't ever use the keyword Global and can avoid using the keyword Window the properties and methods look as if they are part of the core language rather than members of an object. Web browsers are becoming more ECMAScript compliant as new versions are released.

The Global object is added to the scope chain of a program when it commences execution. Other built in objects are accessible as initial properties of the global object. Some of these are added as core functionality and are available in all implementations. Others are added as host objects defined differently for each implementation.

When the Global object is created, it always has at least the following properties:

Most of the properties initially provided by the Global object cannot be enumerated as their DontEnum attribute is set (at least in ECMA-compliant implementations).

The initial properties soon change and are added to when the flow of control enters execution contexts and begins to process scripts.

The value properties that are initially set up in the Global object are listed in this table:

Name
Infinity
NaN

Refer to the discussion on each of value properties for more details.

Some host implementations create aliases for the Global object and store those self referring aliases in the global object when it is initialized. An example of this behavior is the Window object created in some web browser host implementations of JavaScript.

There is one Global object for each window in a web browser. There is also one for each frame in a frame-set. This means that you can have Global objects that have global variables that are not shared with one another.

However, you can access them by referring to the parent object. This goes to an object context that contains the current frame. You can also access the top or outer window of a frame-set hierarchy directly.

Whether you can truly access objects in other windows or frames comes down to some basic security issues. Generally the security policy prevents access to code that arrives from different servers. You can legally get at values in pages served from the same host as your page was served from. It is unreasonable to be able to access variables in a page served from another host. This can lead to difficulties if you serve your site from multiple hosts. It isn't as limiting as all that though and there are ways to grant permission via the security policy in the browser.

Global objects support different sub-sets of the complete range of properties according to the context in which they are used. Server-side JavaScript won't support anything to do with window display and client side (browser) JavaScript does not need to know about request-response handling.

If you want to access a Global object in another context, perhaps in a different window, you need to assign it to a variable. In the syntax listing this is illustrated by assigning references to Global objects to the myGlobal variable.

Warnings:

See also:escape(), eval(), Infinity, isFinite(), isNaN(), NaN, parseFloat(), parseInt(), typeof, undefined, unescape(), Window object

PropertyJavaScriptJScriptNIEOperaNESECMADOMCSSHTMLNotes
clientInformation1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
clipboardData1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
closed1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
crypto1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
defaultStatus1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
dialogArguments1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
dialogHeight1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
dialogLeft1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
dialogTop1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
dialogWidth1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
document1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
event1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
external1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
frame1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
frameRate1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
history1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
innerHeight1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
innerWidth1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
java1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
length1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
location1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
locationbar1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
Math1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
menubar1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
name1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
navigator1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
netscape1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
offScreenBuffering1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
opener1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
outerHeight1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
outerWidth1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
Packages1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
pageXOffset1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
pageYOffset1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
parent1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
personalbar1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
pkcs111.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
returnValue1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
screen1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
screenLeft1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
screenTop1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
screenX1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
screenY1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
scrollbars1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
secure1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
self1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
status1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
statusbar1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
sun1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
toolbar1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
top1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
window1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning

MethodJavaScriptJScriptNIEOperaNESECMADOMCSSHTMLNotes
addClient()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
addResponseHeader()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
alert()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
Array()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
attachEvent()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
back()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
blob()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
blur()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
Boolean()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
callC()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
clearInterval()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
clearTimeout()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
close()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
confirm()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
Date()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
debug()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
deleteResponseHeader()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
detachEvent()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
disableExternalCapture()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
enableExternalCapture()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
escape()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
eval()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
execScript()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
find()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
flush1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
focus()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
forward()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
Function()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
getOptionValue()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
getOptionValueCount()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
home()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
isFinite()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
isNaN()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
moveBy()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
moveTo()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
navigate()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
Number()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
Object()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
open()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
parseFloat()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
parseInt()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
print()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
prompt()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
redirect1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
registerCFunction()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
resizeBy()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
resizeTo()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
scroll()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
scrollBy()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
scrollTo()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
setHotkeys()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
setInterval()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
setResizable()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
setTimeout()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
setZOptions()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
showHelp()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
showModalDialog()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
showModelessDialog()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
ssjs_generateClientID()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
ssjs_getCGIVariable()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
ssjs_getClientID()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
stop()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
String()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
typeof()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
unescape()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning
write()1.0 1.01.0 1.02.0 2.03.0 3.0 n/a n/a2 2 n/a n/a n/aWarning

Event nameJavaScriptJScriptNIEOperaNESECMADOMCSSHTMLNotes
onAfterPrint n/a5.0 5.0 n/a5.0 5.0 n/a n/a n/a n/a n/a n/a-
onBeforePrint n/a5.0 5.0 n/a5.0 5.0 n/a n/a n/a n/a n/a n/a-
onBeforeUnload n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onBlur1.1 1.13.0 3.03.0 3.04.0 4.03.0 3.0 n/a n/a n/a n/a n/aWarning
onDragDrop1.2 1.2 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a n/a-
onError1.1 1.13.0 3.03.0 3.04.0 4.03.0 3.0 n/a n/a n/a n/a n/aWarning
onFocus1.0 1.03.0 3.02.0 2.04.0 4.03.0 3.0 n/a n/a n/a n/a n/aWarning
onHelp n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/aWarning
onLoad1.0 1.01.0 1.02.0 2.03.02 3.023.0 3.0 n/a n/a n/a n/a n/aWarning
onMove1.2 1.2 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a n/a-
onResize1.2 1.23.0 3.04.0 4.04.0 4.0 n/a n/a n/a n/a n/a n/aWarning
onUnload1.0 1.01.0 1.02.0 2.03.02 3.023.0 3.0 n/a n/a n/a n/a n/aWarning

Cross-references:

ECMA 262 edition 2 - section - 10.1.5

ECMA 262 edition 2 - section - 15

ECMA 262 edition 3 - section - 10.1.5

ECMA 262 edition 3 - section - 15.1