public class Window extends EventTarget implements ScriptableWithFallbackGetter, net.sourceforge.htmlunit.corejs.javascript.Function
Modifier and Type | Field and Description |
---|---|
static short |
PERSISTENT
To be documented.
|
static short |
TEMPORARY
To be documented.
|
Constructor and Description |
---|
Window()
Creates an instance.
|
Modifier and Type | Method and Description |
---|---|
void |
alert(Object message)
The JavaScript function "alert()".
|
String |
atob(String encodedData)
Decodes a string of data which has been encoded using base-64 encoding..
|
boolean |
attachEvent(String type,
net.sourceforge.htmlunit.corejs.javascript.Function listener)
Allows the registration of event listeners on the event target.
|
void |
blur()
Removes focus from this element.
|
String |
btoa(String stringToEncode)
Creates a base-64 encoded ASCII string from a string of binary data.
|
Object |
call(net.sourceforge.htmlunit.corejs.javascript.Context cx,
net.sourceforge.htmlunit.corejs.javascript.Scriptable scope,
net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj,
Object[] args) |
void |
captureEvents(String type)
Does nothing special anymore...
|
void |
clearInterval(int intervalID)
Cancels the interval previously started using the setInterval method.
|
void |
clearTimeout(int timeoutId)
Cancels a time-out previously set with the setTimeout method.
|
void |
close()
Closes this window.
|
void |
CollectGarbage()
An undocumented IE function.
|
boolean |
confirm(String message)
The JavaScript function "confirm()".
|
net.sourceforge.htmlunit.corejs.javascript.Scriptable |
construct(net.sourceforge.htmlunit.corejs.javascript.Context cx,
net.sourceforge.htmlunit.corejs.javascript.Scriptable scope,
Object[] args) |
Popup |
createPopup()
Creates a popup window.
|
void |
detachEvent(String type,
net.sourceforge.htmlunit.corejs.javascript.Function listener)
Allows the removal of event listeners on the event target.
|
boolean |
dispatchEvent(Event event)
Dispatches an event into the event system (standards-conformant browsers only).
|
void |
dump(String message)
Prints messages to the console.
|
void |
execScript(String script,
Object language)
Executes the specified script code as long as the language is JavaScript or JScript.
|
ScriptResult |
executeEvent(Event event)
Executes the event on this object only (needed for instance for onload on (i)frame tags).
|
ScriptResult |
executeEvent(Event event,
EventTarget eventTarget)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Executes the event on this window only. |
void |
focus()
Sets the focus to this element.
|
Object |
get(int index,
net.sourceforge.htmlunit.corejs.javascript.Scriptable start) |
ApplicationCache |
getApplicationCache()
Returns the application cache.
|
Navigator |
getClientInformation()
Returns the JavaScript property "clientInformation".
|
ClipboardData |
getClipboardData()
Returns the JavaScript property "clipboardData".
|
boolean |
getClosed()
Indicates if this window is closed.
|
CSS2Properties |
getComputedStyle(Element element,
String pseudo)
Returns computed style of the element.
|
net.sourceforge.htmlunit.corejs.javascript.ScriptableObject |
getConsole()
Returns the console property.
|
Object |
getControllers()
Gets the controllers.
|
Event |
getCurrentEvent()
Returns the current event (used internally regardless of the emulation mode).
|
int |
getDevicePixelRatio()
Returns the
devicePixelRatio property. |
DocumentProxy |
getDocument_js()
Returns the JavaScript property "document".
|
Document |
getDocument()
Returns the window's current document.
|
Object |
getEvent()
Returns the current event (used by JavaScript only when emulating IE).
|
External |
getExternal()
Returns the "external" property.
|
Object |
getFrameElement()
Returns the (i)frame in which the window is contained.
|
WindowProxy |
getFrames_js()
Returns the value of the frames property.
|
History |
getHistory()
Returns the "history" property.
|
int |
getInnerHeight()
Returns the innerHeight.
|
int |
getInnerWidth()
Returns the innerWidth.
|
int |
getLength()
Returns the number of frames contained by this window.
|
Storage |
getLocalStorage()
Returns the localStorage property.
|
Location |
getLocation()
Returns the location property.
|
int |
getMozInnerScreenX()
Returns the value of "mozInnerScreenX" property.
|
int |
getMozInnerScreenY()
Returns the value of "mozInnerScreenY" property.
|
int |
getMozPaintCount()
Returns the value of "mozPaintCount" property.
|
String |
getName()
Returns the value of the window's name property.
|
Navigator |
getNavigator()
Returns the JavaScript property "navigator".
|
Netscape |
getNetscape()
Returns the value of "netscape" property.
|
Object |
getOffscreenBuffering()
Returns the
offscreenBuffering property. |
Object |
getOnbeforeunload()
Returns the value of the window's onbeforeunload property.
|
Object |
getOnchange()
Getter for the onchange event handler.
|
Object |
getOnclick()
Returns the onclick property (caution this is not necessary a function if something else has
been set).
|
Object |
getOndblclick()
Returns the ondblclick property (caution this is not necessary a function if something else has
been set).
|
Object |
getOnerror()
Returns the value of the window's onerror property.
|
Object |
getOnhashchange()
Returns the onhashchange property (caution this is not necessary a function if something else has
been set).
|
Object |
getOnload()
Returns the onload property.
|
Object |
getOnmessage()
Returns the value of the window's
onmessage property. |
Object |
getOpener()
Returns the value of the opener property.
|
int |
getOuterHeight()
Returns the outer height.
|
int |
getOuterWidth()
Returns the outerWidth.
|
int |
getPageXOffset()
Returns the value of "pageXOffset" property.
|
int |
getPageYOffset()
Returns the value of "pageYOffset" property.
|
WindowProxy |
getParent()
Returns the value of the parent property.
|
Performance |
getPerformance()
Returns the
performance property. |
net.sourceforge.htmlunit.corejs.javascript.Scriptable |
getPrototype(Class<? extends SimpleScriptable> jsClass)
Returns the prototype object corresponding to the specified HtmlUnit class inside the window scope.
|
net.sourceforge.htmlunit.corejs.javascript.Scriptable |
getPrototype(String className)
Returns the prototype object corresponding to the specified HtmlUnit class inside the window scope.
|
static WindowProxy |
getProxy(WebWindow w)
Returns the proxy for the specified window.
|
Screen |
getScreen()
Returns the "screen" property.
|
int |
getScrollX()
Returns the value of "scrollX" property.
|
int |
getScrollY()
Returns the value of "scrollY" property.
|
Selection |
getSelection()
Returns the current selection.
|
Selection |
getSelectionImpl()
Returns the current selection.
|
WindowProxy |
getSelf()
Returns the "self" property.
|
Storage |
getSessionStorage()
Returns the sessionStorage property.
|
SpeechSynthesis |
getSpeechSynthesis()
Returns the
speechSynthesis property. |
String |
getStatus()
Returns the text from the status line.
|
Storage |
getStorage(StorageHolder.Type storageType)
Gets the storage of the specified type.
|
StyleMedia |
getStyleMedia()
Returns the
styleMedia property. |
Object |
getTop()
Returns the value of the top property.
|
WebWindow |
getWebWindow()
Returns the WebWindow associated with this Window.
|
WindowProxy |
getWindow_js()
Returns the window property.
|
Object |
getWithFallback(String name)
Fallback called when no configured property is found with the given name
on the
Scriptable object. |
void |
initialize()
Initializes the object.
|
void |
initialize(Page enclosedPage)
Initialize the object.
|
void |
initialize(WebWindow webWindow)
Initializes this window.
|
boolean |
isConst(String name)
Used to allow re-declaration of constants (eg: "var undefined;").
|
MediaQueryList |
matchMedia(String mediaQueryString)
Returns a new MediaQueryList object representing the parsed results of the specified media query string.
|
void |
moveBy(int x,
int y)
Does nothing.
|
void |
moveTo(int x,
int y)
Does nothing.
|
void |
navigate(String url)
Loads the new HTML document corresponding to the specified URL.
|
WindowProxy |
open(Object url,
Object name,
Object features,
Object replace)
Opens a new window.
|
void |
postMessage(String message,
String targetOrigin,
Object transfer)
Posts a message.
|
void |
print()
Prints the current page.
|
String |
prompt(String message)
The JavaScript function "prompt()".
|
void |
resizeBy(int width,
int height)
Does nothing.
|
void |
resizeTo(int width,
int height)
Does nothing.
|
String |
ScriptEngine()
Gets the name of the scripting engine.
|
int |
ScriptEngineBuildVersion()
Gets the build version of the scripting engine.
|
int |
ScriptEngineMajorVersion()
Gets the major version of the scripting engine.
|
int |
ScriptEngineMinorVersion()
Gets the minor version of the scripting engine.
|
void |
scroll(int x,
int y)
Scrolls to the specified location on the page.
|
void |
scrollBy(int x,
int y)
Scrolls the window content the specified distance.
|
void |
scrollByLines(int lines)
Scrolls the window content down by the specified number of lines.
|
void |
scrollByPages(int pages)
Scrolls the window content down by the specified number of pages.
|
void |
scrollTo(int x,
int y)
Scrolls to the specified location on the page.
|
void |
setConsole(net.sourceforge.htmlunit.corejs.javascript.ScriptableObject console)
Sets the console.
|
void |
setControllers(Object value)
Sets the controllers.
|
void |
setCurrentEvent(Event event)
Sets the current event.
|
int |
setInterval(Object code,
int timeout,
Object language)
Sets a chunk of JavaScript to be invoked each time a specified number of milliseconds has elapsed.
|
void |
setLocation(String newLocation)
Sets the location property.
|
void |
setName(String name)
Sets the value of the window's name property.
|
void |
setOnbeforeunload(Object onbeforeunload)
Sets the value of the window's onbeforeunload property.
|
void |
setOnchange(Object onchange)
Setter for the onchange event handler.
|
void |
setOnclick(Object newOnload)
Sets the value of the onclick event handler.
|
void |
setOndblclick(Object newHandler)
Sets the value of the ondblclick event handler.
|
void |
setOnerror(Object onerror)
Sets the value of the window's onerror property.
|
void |
setOnhashchange(Object newHandler)
Sets the value of the onhashchange event handler.
|
void |
setOnload(Object newOnload)
Sets the value of the onload event handler.
|
void |
setOnmessage(Object onmessage)
Sets the value of the window's
onmessage property. |
void |
setOpener(Object newValue)
Sets the opener property.
|
void |
setPrototypes(Map<Class<? extends SimpleScriptable>,net.sourceforge.htmlunit.corejs.javascript.Scriptable> map,
Map<String,net.sourceforge.htmlunit.corejs.javascript.Scriptable> prototypesPerJSName)
Sets the prototypes for HtmlUnit host classes.
|
void |
setStatus(String message)
Sets the text from the status line.
|
int |
setTimeout(Object code,
int timeout,
Object language)
Sets a chunk of JavaScript to be invoked at some specified time later.
|
void |
setTop(Object o)
Sets the value of the top property.
|
Object |
showModalDialog(String url,
Object arguments,
String features)
Creates a modal dialog box that displays the specified HTML document.
|
Object |
showModelessDialog(String url,
Object arguments,
String features)
Creates a modeless dialog box that displays the specified HTML document.
|
void |
stop()
Should implement the stop() function on the window object.
|
void |
triggerOnError(ScriptException e)
Triggers the onerror handler, if one has been set.
|
addEventListener, clearEventListenersContainer, fireEvent, getEventHandler, getEventHandlerProp, getEventListenersContainer, hasEventHandlers, removeEventListener, setEventHandler, setEventHandlerProp
clone, defineFunctionProperties, defineProperty, equivalentValues, get, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getScriptableFor, getStartingScope, getTransformerScriptableFor, getWindow, getWindow, getWithPreemption, hasInstance, initParentScope, isReadOnlySettable, makeScriptableFor, setCaseSensitive, setClassName, setDomNode, setDomNode, setHtmlElement, setParentScope
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, isAccessorDescriptor, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setExternalArrayData, setGetterOrSetter, setPrototype, size
public static final short TEMPORARY
public static final short PERSISTENT
public net.sourceforge.htmlunit.corejs.javascript.Scriptable getPrototype(Class<? extends SimpleScriptable> jsClass)
getPrototype
in class SimpleScriptable
jsClass
- the class whose prototype is to be returnedpublic net.sourceforge.htmlunit.corejs.javascript.Scriptable getPrototype(String className)
className
- the class name whose prototype is to be returnedpublic void setPrototypes(Map<Class<? extends SimpleScriptable>,net.sourceforge.htmlunit.corejs.javascript.Scriptable> map, Map<String,net.sourceforge.htmlunit.corejs.javascript.Scriptable> prototypesPerJSName)
public void alert(Object message)
message
- the messagepublic String btoa(String stringToEncode)
stringToEncode
- string to encodepublic String atob(String encodedData)
encodedData
- the encoded stringpublic boolean confirm(String message)
message
- the messagepublic String prompt(String message)
message
- the messagepublic DocumentProxy getDocument_js()
public Document getDocument()
public ApplicationCache getApplicationCache()
public Object getEvent()
public Event getCurrentEvent()
public void setCurrentEvent(Event event)
event
- the current eventpublic WindowProxy open(Object url, Object name, Object features, Object replace)
url
- when a new document is opened, url is a String that specifies a MIME type for the document.
When a new window is opened, url is a String that specifies the URL to render in the new windowname
- the namefeatures
- the featuresreplace
- whether to replace in the history list or noWebClientOptions.isPopupBlockerEnabled()
,
MSDN documentationpublic Popup createPopup()
public int setTimeout(Object code, int timeout, Object language)
code
- specifies the function pointer or string that indicates the code to be executed
when the specified interval has elapsedtimeout
- specifies the number of millisecondslanguage
- specifies languagepublic void clearTimeout(int timeoutId)
timeoutId
- identifier for the timeout to clear (returned by setTimeout)public Navigator getNavigator()
public Navigator getClientInformation()
public ClipboardData getClipboardData()
public WindowProxy getWindow_js()
public WindowProxy getSelf()
public Storage getLocalStorage()
public Storage getSessionStorage()
public Storage getStorage(StorageHolder.Type storageType)
storageType
- the typepublic Location getLocation()
public void setLocation(String newLocation) throws IOException
newLocation
- the URL of the new contentIOException
- when location loading failspublic net.sourceforge.htmlunit.corejs.javascript.ScriptableObject getConsole()
public void setConsole(net.sourceforge.htmlunit.corejs.javascript.ScriptableObject console)
console
- the consolepublic void dump(String message)
message
- the message to logpublic Screen getScreen()
public History getHistory()
public External getExternal()
public void initialize(WebWindow webWindow)
webWindow
- the web window corresponding to this windowpublic void initialize(Page enclosedPage)
enclosedPage
- the page containing the JavaScriptpublic void initialize()
public Object getTop()
public void setTop(Object o)
o
- the new valuepublic WindowProxy getParent()
public Object getOpener()
public void setOpener(Object newValue)
newValue
- the new valuepublic Object getFrameElement()
null
for a top level windowpublic WindowProxy getFrames_js()
public int getLength()
public WebWindow getWebWindow()
public void focus()
public void blur()
public void close()
public boolean getClosed()
true
if this window is closedpublic void moveTo(int x, int y)
x
- the horizontal positiony
- the vertical positionpublic void moveBy(int x, int y)
x
- the horizontal positiony
- the vertical positionpublic void navigate(String url) throws IOException
url
- the location of the new HTML document to loadIOException
- if loading the specified location failspublic void resizeBy(int width, int height)
width
- the width offsetheight
- the height offsetpublic void resizeTo(int width, int height)
width
- the width of the Window in pixel after resizeheight
- the height of the Window in pixel after resizepublic void scroll(int x, int y)
x
- the horizontal position to scroll toy
- the vertical position to scroll topublic void scrollBy(int x, int y)
x
- the horizontal distance to scroll byy
- the vertical distance to scroll bypublic void scrollByLines(int lines)
lines
- the number of lines to scroll downpublic void scrollByPages(int pages)
pages
- the number of pages to scroll downpublic void scrollTo(int x, int y)
x
- the horizontal position to scroll toy
- the vertical position to scroll topublic void setOnload(Object newOnload)
newOnload
- the new handlerpublic void setOnclick(Object newOnload)
newOnload
- the new handlerpublic Object getOnclick()
public void setOndblclick(Object newHandler)
newHandler
- the new handlerpublic Object getOndblclick()
public Object getOnload()
public Object getOnhashchange()
public void setOnhashchange(Object newHandler)
newHandler
- the new handlerpublic boolean attachEvent(String type, net.sourceforge.htmlunit.corejs.javascript.Function listener)
type
- the event type to listen for (like "load")listener
- the event listenertrue
if the listener has been addedpublic void detachEvent(String type, net.sourceforge.htmlunit.corejs.javascript.Function listener)
type
- the event type to listen for (like "onload")listener
- the event listenerpublic String getName()
public void setName(String name)
name
- the value of the window's name propertypublic Object getOnbeforeunload()
public void setOnbeforeunload(Object onbeforeunload)
onbeforeunload
- the value of the window's onbeforeunload propertypublic Object getOnerror()
public void setOnerror(Object onerror)
onerror
- the value of the window's onerror propertypublic Object getOnmessage()
onmessage
property.onmessage
propertypublic void setOnmessage(Object onmessage)
onmessage
property.onmessage
- the value of the window's onmessage
propertypublic void triggerOnError(ScriptException e)
e
- the error that needs to be reportedpublic Object call(net.sourceforge.htmlunit.corejs.javascript.Context cx, net.sourceforge.htmlunit.corejs.javascript.Scriptable scope, net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args)
call
in interface net.sourceforge.htmlunit.corejs.javascript.Callable
call
in interface net.sourceforge.htmlunit.corejs.javascript.Function
public net.sourceforge.htmlunit.corejs.javascript.Scriptable construct(net.sourceforge.htmlunit.corejs.javascript.Context cx, net.sourceforge.htmlunit.corejs.javascript.Scriptable scope, Object[] args)
construct
in interface net.sourceforge.htmlunit.corejs.javascript.Function
public Object getWithFallback(String name)
Scriptable
object.getWithFallback
in interface ScriptableWithFallbackGetter
name
- the name of the requested propertyScriptable.NOT_FOUND
if nothing is foundpublic Object get(int index, net.sourceforge.htmlunit.corejs.javascript.Scriptable start)
get
in interface net.sourceforge.htmlunit.corejs.javascript.Scriptable
get
in class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
public static WindowProxy getProxy(WebWindow w)
w
- the window whose proxy is to be returnedpublic void execScript(String script, Object language)
script
- the script code to executelanguage
- the language of the specified code ("JavaScript" or "JScript")public String getStatus()
public void setStatus(String message)
message
- the status line textpublic int setInterval(Object code, int timeout, Object language)
code
- specifies the function pointer or string that indicates the code to be executed
when the specified interval has elapsedtimeout
- specifies the number of millisecondslanguage
- specifies languagepublic void clearInterval(int intervalID)
intervalID
- specifies the interval to cancel as returned by the setInterval methodpublic int getInnerWidth()
public int getOuterWidth()
public int getInnerHeight()
public int getOuterHeight()
public void print()
public void captureEvents(String type)
type
- the type of events to captureDocument.captureEvents(String)
public void CollectGarbage()
public CSS2Properties getComputedStyle(Element element, String pseudo)
element
- the elementpseudo
- a string specifying the pseudo-element to match (may be null)public Selection getSelection()
public Selection getSelectionImpl()
public Object showModalDialog(String url, Object arguments, String features)
url
- the URL of the document to load and displayarguments
- object to be made available via window.dialogArguments in the dialog windowfeatures
- string that specifies the window ornaments for the dialog windowpublic Object showModelessDialog(String url, Object arguments, String features)
url
- the URL of the document to load and displayarguments
- object to be made available via window.dialogArguments in the dialog windowfeatures
- string that specifies the window ornaments for the dialog windowpublic Object getControllers()
public void setControllers(Object value)
value
- the new valuepublic int getMozInnerScreenX()
public int getMozInnerScreenY()
public int getMozPaintCount()
public String ScriptEngine()
public int ScriptEngineBuildVersion()
public int ScriptEngineMajorVersion()
public int ScriptEngineMinorVersion()
public void stop()
public int getPageXOffset()
public int getPageYOffset()
public int getScrollX()
public int getScrollY()
public Netscape getNetscape()
public ScriptResult executeEvent(Event event)
executeEvent
in class EventTarget
event
- the eventpublic ScriptResult executeEvent(Event event, EventTarget eventTarget)
event
- the eventeventTarget
- the event targetpublic boolean isConst(String name)
isConst
in interface net.sourceforge.htmlunit.corejs.javascript.ConstProperties
isConst
in class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
com.gargoylesoftware.htmlunit.javascript.NativeGlobalTest
public boolean dispatchEvent(Event event)
dispatchEvent
in class EventTarget
event
- the event to be dispatchedpublic Object getOnchange()
public void setOnchange(Object onchange)
onchange
- the handlerpublic void postMessage(String message, String targetOrigin, Object transfer)
message
- the object passed to the windowtargetOrigin
- the origin this window must be for the event to be dispatchedtransfer
- an optional sequence of Transferable objectspublic Performance getPerformance()
performance
property.performance
propertypublic int getDevicePixelRatio()
devicePixelRatio
property.devicePixelRatio
propertypublic StyleMedia getStyleMedia()
styleMedia
property.styleMedia
propertypublic MediaQueryList matchMedia(String mediaQueryString)
mediaQueryString
- the media querypublic SpeechSynthesis getSpeechSynthesis()
speechSynthesis
property.speechSynthesis
propertypublic Object getOffscreenBuffering()
offscreenBuffering
property.offscreenBuffering
propertyCopyright © 2002–2015 Gargoyle Software Inc.. All rights reserved.