JavaScript is disabled on your browser.
Skip navigation links
org.htmlunit.javascript.host

Class Location

    • Field Summary

      • Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject

        CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
      • Fields inherited from interface org.htmlunit.corejs.javascript.Scriptable

        NOT_FOUND
    • Constructor Summary

      Constructors
      Constructor and Description
      Location ()
    • Method Summary

      All Methods
      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 '?').
      • Methods inherited from class org.htmlunit.corejs.javascript.ScriptableObject

        applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChangeForSlot, checkPropertyDefinition, defineBuiltInProperty, defineBuiltInProperty, defineBuiltInProperty, defineBuiltInProperty, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureScriptableObjectButNotSymbol, ensureSymbolScriptable, ensureType, 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, getSuperProperty, getSuperProperty, getSuperProperty, 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, putOwnProperty, putOwnProperty, putOwnProperty, putProperty, putProperty, putProperty, putSuperProperty, putSuperProperty, putSuperProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setPrototype, size
      • Methods inherited from class org.htmlunit.corejs.javascript.SlotMapOwner

        createSlotMap
    • Constructor Detail

      • Location

        public Location()
    • Method Detail

      • jsConstructor

        public void jsConstructor()
        Creates an instance.
      • initialize

        public void initialize(Window window,
         Page page)
        Initializes this Location.
        Parameters:
        window - the window that this location belongs to
        page - the page that will become the enclosing page
      • getDefaultValue

        public Object getDefaultValue(Class<?> hint)
        Returns the JavaScript default value of this object. This is the JavaScript equivalent of a toString() in Java.
        Specified by:
        getDefaultValue in interface org.htmlunit.corejs.javascript.Scriptable
        Overrides:
        getDefaultValue in class HtmlUnitScriptable
        Parameters:
        hint - a hint as to the format of the default value (ignored in this case)
        Returns:
        the default value
      • assign

        public void assign(String url)
         throws IOException 
        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:
        MSDN Documentation
      • reload

        public void reload(boolean force)
         throws IOException 
        Reloads the current page, possibly forcing retrieval from the server even if the browser cache contains the latest version of the document.
        Parameters:
        force - if true, force reload from server; otherwise, may reload from cache
        Throws:
        IOException - if there is a problem reloading the page
        See Also:
        MSDN Documentation
      • replace

        public void replace(String url)
         throws IOException 
        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:
        MSDN Documentation
      • jsToString

        public String jsToString()
        Returns the location URL.
        Returns:
        the location URL
      • setHref

        public void setHref(String newLocation)
         throws IOException 
        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:
        MSDN Documentation
      • getSearch

        public String getSearch()
        Returns the search portion of the location URL (the portion following the '?').
        Returns:
        the search portion of the location URL
        See Also:
        MSDN Documentation
      • setSearch

        public void setSearch(String search)
         throws Exception 
        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:
        MSDN Documentation
      • getHash

        public String getHash()
        Returns the hash portion of the location URL (the portion following the '#').
        Returns:
        the hash portion of the location URL
        See Also:
        MSDN Documentation
      • setHash

        public void setHash(String hash)
        Sets the hash portion of the location URL (the portion following the '#').
        Parameters:
        hash - the new hash portion of the location URL
        See Also:
        MSDN Documentation
      • setHash

        public void setHash(String oldURL,
         String hash)
        Sets the hash portion of the location URL (the portion following the '#').
        Parameters:
        oldURL - the old URL
        hash - the new hash portion of the location URL
      • setHash

        public void setHash(String oldURL,
         String hash,
         boolean triggerHashChanged)
        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 URL
        hash - the new hash portion of the location URL
        triggerHashChanged - option to disable event triggering
      • getHostname

        public String getHostname()
        Returns the hostname portion of the location URL.
        Returns:
        the hostname portion of the location URL
        See Also:
        MSDN Documentation
      • setHostname

        public void setHostname(String hostname)
         throws Exception 
        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:
        MSDN Documentation
      • getHost

        public String getHost()
        Returns the host portion of the location URL (the '[hostname]:[port]' portion).
        Returns:
        the host portion of the location URL
        See Also:
        MSDN Documentation
      • setHost

        public void setHost(String host)
         throws Exception 
        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:
        MSDN Documentation
      • getPathname

        public String getPathname()
        Returns the pathname portion of the location URL.
        Returns:
        the pathname portion of the location URL
        See Also:
        MSDN Documentation
      • setPathname

        public void setPathname(String pathname)
         throws Exception 
        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:
        MSDN Documentation
      • getPort

        public String getPort()
        Returns the port portion of the location URL.
        Returns:
        the port portion of the location URL
        See Also:
        MSDN Documentation
      • setPort

        public void setPort(String port)
         throws Exception 
        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:
        MSDN Documentation
      • getProtocol

        public String 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:
        MSDN Documentation
      • setProtocol

        public void setProtocol(String protocol)
         throws Exception 
        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:
        MSDN Documentation
      • getOrigin

        public String getOrigin()
        Returns the origin property.
        Returns:
        the origin property
Skip navigation links

Copyright © 2002–2025 Gargoyle Software Inc.. All rights reserved.

AltStyle によって変換されたページ (->オリジナル) /