Interface Location

All Known Implementing Classes:
LocationImpl

public interface Location
The location (URL) of the object it is linked to. Changes done on it are reflected on the object it relates to. Both the Document and Window interface have such a linked Location, accessible via Document.location and Window.location respectively.
  • Method Details

    • getAncestorOrigins

      DOMStringList getAncestorOrigins()

      getAncestorOrigins.

      Returns:
      a DOMStringList object.
    • getHash

      String getHash()
      Returns the Location object's URL's fragment (includes leading "#" if non-empty).

      Can be set, to navigate to the same URL with a changed fragment (ignores leading "#").

      Returns:
      a String object.
    • setHash

      void setHash(String hash)

      setHash.

      Parameters:
      hash - a String object.
    • getHost

      String getHost()
      Returns the Location object's URL's host and port (if different from the default port for the scheme).

      Can be set, to navigate to the same URL with a changed host and port.

      Returns:
      a String object.
    • setHost

      void setHost(String host)

      setHost.

      Parameters:
      host - a String object.
    • getHostname

      String getHostname()
      Returns the Location object's URL's host.

      Can be set, to navigate to the same URL with a changed host.

      Returns:
      a String object.
    • setHostname

      void setHostname(String hostname)

      setHostname.

      Parameters:
      hostname - a String object.
    • getHref

      String getHref()
      Returns the Location object's URL.

      Can be set, to navigate to the given URL.

      Returns:
      a String object.
    • setHref

      void setHref(String href)

      setHref.

      Parameters:
      href - a String object.
    • getOrigin

      String getOrigin()
      Returns the Location object's URL's origin.
      Returns:
      a String object.
    • getPathname

      String getPathname()
      Returns the Location object's URL's path.

      Can be set, to navigate to the same URL with a changed path.

      Returns:
      a String object.
    • setPathname

      void setPathname(String pathname)

      setPathname.

      Parameters:
      pathname - a String object.
    • getPort

      String getPort()
      Returns the Location object's URL's port.

      Can be set, to navigate to the same URL with a changed port.

      Returns:
      a String object.
    • setPort

      void setPort(String port)

      setPort.

      Parameters:
      port - a String object.
    • getProtocol

      String getProtocol()
      Returns the Location object's URL's scheme.

      Can be set, to navigate to the same URL with a changed scheme.

      Returns:
      a String object.
    • setProtocol

      void setProtocol(String protocol)

      setProtocol.

      Parameters:
      protocol - a String object.
    • getSearch

      String getSearch()
      Returns the Location object's URL's query (includes leading "?" if non-empty).

      Can be set, to navigate to the same URL with a changed query (ignores leading "?").

      Returns:
      a String object.
    • setSearch

      void setSearch(String search)

      setSearch.

      Parameters:
      search - a String object.
    • assign

      void assign(String url)
      Navigates to the given URL.
      Parameters:
      url - a String object.
    • reload

      void reload()
      Reloads the current page.
    • reload

      @Deprecated void reload(boolean forcedReload)
      Deprecated.

      reload.

      Parameters:
      forcedReload - a boolean.
    • replace

      void replace(String url)
      Removes the current page from the session history and navigates to the given URL.
      Parameters:
      url - a String object.