Package org.htmlunit.javascript.host
Class Location
java.lang.Object
org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.javascript.HtmlUnitScriptable
org.htmlunit.javascript.host.Location
- All Implemented Interfaces:
Serializable,Cloneable,org.htmlunit.corejs.javascript.ConstProperties,org.htmlunit.corejs.javascript.debug.DebuggableObject,org.htmlunit.corejs.javascript.Scriptable,org.htmlunit.corejs.javascript.SymbolScriptable
A JavaScript object for
Location.- Author:
- Mike Bowler, Michael Ottati, Marc Guillemot, Chris Erskine, Daniel Gredler, David K. Taylor, Ahmed Ashour, Ronald Brill, Frank Danek, Adam Afeltowicz, Atsushi Nakagawa
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator -
Field Summary
Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONSTFields inherited from interface org.htmlunit.corejs.javascript.Scriptable
NOT_FOUND -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidLoads the new HTML document corresponding to the specified URL.getDefaultValue(Class<?> hint) Returns the JavaScript default value of this object.getHash()Returns the hash portion of the location URL (the portion following the '#').getHost()Returns the host portion of the location URL (the '[hostname]:[port]' portion).Returns the hostname portion of the location URL.getHref()Returns the location URL.Returns theoriginproperty.Returns the pathname portion of the location URL.getPort()Returns the port portion of the location URL.Returns the protocol portion of the location URL, including the trailing ':'.Returns the search portion of the location URL (the portion following the '?').voidinitialize(Window window, Page page) Initializes this Location.voidCreates an instance.Returns the location URL.voidreload(boolean force) Reloads the current page, possibly forcing retrieval from the server even if the browser cache contains the latest version of the document.voidReloads the window using the specified URL via a postponed action.voidSets the hash portion of the location URL (the portion following the '#').voidSets the hash portion of the location URL (the portion following the '#').voidINTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Sets the hash portion of the location URL (the portion following the '#').voidSets the host portion of the location URL (the '[hostname]:[port]' portion).voidsetHostname(String hostname) Sets the hostname portion of the location URL.voidSets the location URL to an entirely new value.voidsetPathname(String pathname) Sets the pathname portion of the location URL.voidSets the port portion of the location URL.voidsetProtocol(String protocol) Sets the protocol portion of the location URL.voidSets the search portion of the location URL (the portion following the '?').Methods inherited from class org.htmlunit.javascript.HtmlUnitScriptable
clone, equivalentValues, get, getBrowserVersion, getClassName, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getWindow, getWindow, getWithPreemption, has, hasInstance, initParentScope, makeScriptableFor, put, setClassName, setDomNode, setDomNode, setParentScope, setupPromise, setupRejectedPromiseMethods inherited from class org.htmlunit.corejs.javascript.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setPrototype, size
-
Constructor Details
-
Location
public Location()Creates an instance.
-
-
Method Details
-
jsConstructor
public void jsConstructor()Creates an instance. -
initialize
Initializes this Location.- Parameters:
window- the window that this location belongs topage- the page that will become the enclosing page
-
getDefaultValue
Returns the JavaScript default value of this object. This is the JavaScript equivalent of a toString() in Java.- Specified by:
getDefaultValuein interfaceorg.htmlunit.corejs.javascript.Scriptable- Overrides:
getDefaultValuein classHtmlUnitScriptable- Parameters:
hint- a hint as to the format of the default value (ignored in this case)- Returns:
- the default value
-
assign
Loads the new HTML document corresponding to the specified URL.- Parameters:
url- the location of the new HTML document to load- Throws:
IOException- if loading the specified location fails- See Also:
-
reload
Reloads the current page, possibly forcing retrieval from the server even if the browser cache contains the latest version of the document.- Parameters:
force- iftrue, force reload from server; otherwise, may reload from cache- Throws:
IOException- if there is a problem reloading the page- See Also:
-
replace
Reloads the window using the specified URL via a postponed action.- Parameters:
url- the new URL to use to reload the window- Throws:
IOException- if loading the specified location fails- See Also:
-
jsToString
Returns the location URL.- Returns:
- the location URL
-
getHref
Returns the location URL.- Returns:
- the location URL
- See Also:
-
setHref
Sets the location URL to an entirely new value.- Parameters:
newLocation- the new location URL- Throws:
IOException- if loading the specified location fails- See Also:
-
getSearch
Returns the search portion of the location URL (the portion following the '?').- Returns:
- the search portion of the location URL
- See Also:
-
setSearch
Sets the search portion of the location URL (the portion following the '?').- Parameters:
search- the new search portion of the location URL- Throws:
Exception- if an error occurs- See Also:
-
getHash
Returns the hash portion of the location URL (the portion following the '#').- Returns:
- the hash portion of the location URL
- See Also:
-
setHash
Sets the hash portion of the location URL (the portion following the '#').- Parameters:
hash- the new hash portion of the location URL- See Also:
-
setHash
Sets the hash portion of the location URL (the portion following the '#').- Parameters:
oldURL- the old URLhash- the new hash portion of the location URL
-
setHash
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Sets the hash portion of the location URL (the portion following the '#').- Parameters:
oldURL- the old URLhash- the new hash portion of the location URLtriggerHashChanged- option to disable event triggering
-
getHostname
Returns the hostname portion of the location URL.- Returns:
- the hostname portion of the location URL
- See Also:
-
setHostname
Sets the hostname portion of the location URL.- Parameters:
hostname- the new hostname portion of the location URL- Throws:
Exception- if an error occurs- See Also:
-
getHost
Returns the host portion of the location URL (the '[hostname]:[port]' portion).- Returns:
- the host portion of the location URL
- See Also:
-
setHost
Sets the host portion of the location URL (the '[hostname]:[port]' portion).- Parameters:
host- the new host portion of the location URL- Throws:
Exception- if an error occurs- See Also:
-
getPathname
Returns the pathname portion of the location URL.- Returns:
- the pathname portion of the location URL
- See Also:
-
setPathname
Sets the pathname portion of the location URL.- Parameters:
pathname- the new pathname portion of the location URL- Throws:
Exception- if an error occurs- See Also:
-
getPort
Returns the port portion of the location URL.- Returns:
- the port portion of the location URL
- See Also:
-
setPort
Sets the port portion of the location URL.- Parameters:
port- the new port portion of the location URL- Throws:
Exception- if an error occurs- See Also:
-
getProtocol
Returns the protocol portion of the location URL, including the trailing ':'.- Returns:
- the protocol portion of the location URL, including the trailing ':'
- See Also:
-
setProtocol
Sets the protocol portion of the location URL.- Parameters:
protocol- the new protocol portion of the location URL- Throws:
Exception- if an error occurs- See Also:
-
getOrigin
Returns theoriginproperty.- Returns:
- the
originproperty
-