public class Location extends HtmlUnitScriptable
Location
.org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
NOT_FOUND
Constructor and Description |
---|
Location() |
Modifier and Type | Method and Description |
---|---|
void |
assign(String url)
Loads the new HTML document corresponding to the specified URL.
|
Object |
getDefaultValue(Class<?> hint)
Returns the JavaScript default value of this object.
|
String |
getHash()
Returns the hash portion of the location URL (the portion following the '#').
|
String |
getHost()
Returns the host portion of the location URL (the '[hostname]:[port]' portion).
|
String |
getHostname()
Returns the hostname portion of the location URL.
|
String |
getHref()
Returns the location URL.
|
String |
getOrigin()
Returns the
origin property. |
String |
getPathname()
Returns the pathname portion of the location URL.
|
String |
getPort()
Returns the port portion of the location URL.
|
String |
getProtocol()
Returns the protocol portion of the location URL, including the trailing ':'.
|
String |
getSearch()
Returns the search portion of the location URL (the portion following the '?').
|
void |
initialize(Window window,
Page page)
Initializes this Location.
|
void |
jsConstructor()
Creates an instance.
|
String |
jsToString()
Returns the location URL.
|
void |
reload(boolean force)
Reloads the current page, possibly forcing retrieval from the server even if
the browser cache contains the latest version of the document.
|
void |
replace(String url)
Reloads the window using the specified URL via a postponed action.
|
void |
setHash(String hash)
Sets the hash portion of the location URL (the portion following the '#').
|
void |
setHash(String oldURL,
String hash)
Sets the hash portion of the location URL (the portion following the '#').
|
void |
setHash(String oldURL,
String hash,
boolean triggerHashChanged)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
|
void |
setHost(String host)
Sets the host portion of the location URL (the '[hostname]:[port]' portion).
|
void |
setHostname(String hostname)
Sets the hostname portion of the location URL.
|
void |
setHref(String newLocation)
Sets the location URL to an entirely new value.
|
void |
setPathname(String pathname)
Sets the pathname portion of the location URL.
|
void |
setPort(String port)
Sets the port portion of the location URL.
|
void |
setProtocol(String protocol)
Sets the protocol portion of the location URL.
|
void |
setSearch(String search)
Sets the search portion of the location URL (the portion following the '?').
|
clone, equivalentValues, get, getBrowserVersion, getClassName, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getWindow, getWindow, getWindowFromTopCallScope, getWithPreemption, has, hasInstance, initParentScope, makeScriptableFor, put, setClassName, setDomNode, setDomNode, setParentScope, setupPromise, setupRejectedPromise
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, 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
public void jsConstructor()
public void initialize(Window window, Page page)
window
- the window that this location belongs topage
- the page that will become the enclosing pagepublic Object getDefaultValue(Class<?> hint)
getDefaultValue
in interface org.htmlunit.corejs.javascript.Scriptable
getDefaultValue
in class HtmlUnitScriptable
hint
- a hint as to the format of the default value (ignored in this case)public void assign(String url) throws IOException
url
- the location of the new HTML document to loadIOException
- if loading the specified location failspublic void reload(boolean force) throws IOException
force
- if true
, force reload from server; otherwise, may reload from cacheIOException
- if there is a problem reloading the pagepublic void replace(String url) throws IOException
url
- the new URL to use to reload the windowIOException
- if loading the specified location failspublic String jsToString()
public String getHref()
public void setHref(String newLocation) throws IOException
newLocation
- the new location URLIOException
- if loading the specified location failspublic String getSearch()
public void setSearch(String search) throws Exception
search
- the new search portion of the location URLException
- if an error occurspublic String getHash()
public void setHash(String hash)
hash
- the new hash portion of the location URLpublic void setHash(String oldURL, String hash)
oldURL
- the old URLhash
- the new hash portion of the location URLpublic void setHash(String oldURL, String hash, boolean triggerHashChanged)
oldURL
- the old URLhash
- the new hash portion of the location URLtriggerHashChanged
- option to disable event triggeringpublic String getHostname()
public void setHostname(String hostname) throws Exception
hostname
- the new hostname portion of the location URLException
- if an error occurspublic String getHost()
public void setHost(String host) throws Exception
host
- the new host portion of the location URLException
- if an error occurspublic String getPathname()
public void setPathname(String pathname) throws Exception
pathname
- the new pathname portion of the location URLException
- if an error occurspublic String getPort()
public void setPort(String port) throws Exception
port
- the new port portion of the location URLException
- if an error occurspublic String getProtocol()
public void setProtocol(String protocol) throws Exception
protocol
- the new protocol portion of the location URLException
- if an error occurspublic String getOrigin()
origin
property.origin
propertyCopyright © 2002–2024 Gargoyle Software Inc.. All rights reserved.