Class HTMLAnchorElement

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, org.htmlunit.corejs.javascript.ConstProperties, org.htmlunit.corejs.javascript.debug.DebuggableObject, org.htmlunit.corejs.javascript.Scriptable, org.htmlunit.corejs.javascript.SymbolScriptable

    public class HTMLAnchorElement
    extends HTMLElement
    The JavaScript object that represents an anchor.
    See Also:
    Serialized Form
    • Field Detail

      • REFERRER_POLICIES

        private static final java.util.List<java.lang.String> REFERRER_POLICIES
    • Constructor Detail

      • HTMLAnchorElement

        public HTMLAnchorElement()
        The constructor.
    • Method Detail

      • setHref

        public void setHref​(java.lang.String href)
        Sets the href property.
        Parameters:
        href - the href property value
      • getHref

        public java.lang.String getHref()
        Returns the value of this link's href property.
        Returns:
        the value of this link's href property
      • focus

        public void focus()
        Sets the focus to this element.
        Overrides:
        focus in class HTMLElement
      • setName

        public void setName​(java.lang.String name)
        Sets the name property.
        Overrides:
        setName in class HTMLElement
        Parameters:
        name - name attribute value
      • getName

        public java.lang.String getName()
        Returns the value of the name property of this link.
        Overrides:
        getName in class HTMLElement
        Returns:
        the name property
      • setTarget

        public void setTarget​(java.lang.String target)
        Sets the target property of this link.
        Parameters:
        target - target attribute value
      • getTarget

        public java.lang.String getTarget()
        Returns the value of the target property of this link.
        Returns:
        the href property
      • getUrl

        private java.net.URL getUrl()
                             throws java.net.MalformedURLException
        Returns this link's current URL.
        Returns:
        this link's current URL
        Throws:
        java.net.MalformedURLException - if an error occurs
      • setUrl

        private void setUrl​(java.net.URL url)
        Sets the href attribute of this link to the specified URL.
        Parameters:
        url - the new value of the href attribute
      • setRel

        public void setRel​(java.lang.String rel)
        Sets the rel property.
        Parameters:
        rel - rel attribute value
      • getRel

        public java.lang.String getRel()
        Returns the value of the rel property.
        Returns:
        the rel property
      • getRev

        public java.lang.String getRev()
        Returns the value of the rev property.
        Returns:
        the rev property
      • setRev

        public void setRev​(java.lang.String rel)
        Sets the rev property.
        Parameters:
        rel - rev attribute value
      • getReferrerPolicy

        public java.lang.String getReferrerPolicy()
        Returns the value of the rev property.
        Returns:
        the referrerPolicy property
      • setReferrerPolicy

        public void setReferrerPolicy​(java.lang.String referrerPolicy)
        Sets the rev property.
        Parameters:
        referrerPolicy - referrerPolicy attribute value
      • getSearch

        public java.lang.String getSearch()
        Returns the search portion of the link's URL (the portion starting with '?' and up to but not including any '#').
        Returns:
        the search portion of the link's URL
        See Also:
        MSDN Documentation
      • setSearch

        public void setSearch​(java.lang.String search)
                       throws java.lang.Exception
        Sets the search portion of the link's URL (the portion starting with '?' and up to but not including any '#')..
        Parameters:
        search - the new search portion of the link's URL
        Throws:
        java.lang.Exception - if an error occurs
        See Also:
        MSDN Documentation
      • getHash

        public java.lang.String getHash()
        Returns the hash portion of the link's URL (the portion following the '#', including the '#').
        Returns:
        the hash portion of the link's URL
        See Also:
        MSDN Documentation
      • setHash

        public void setHash​(java.lang.String hash)
                     throws java.lang.Exception
        Sets the hash portion of the link's URL (the portion following the '#').
        Parameters:
        hash - the new hash portion of the link's URL
        Throws:
        java.lang.Exception - if an error occurs
        See Also:
        MSDN Documentation
      • getHost

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

        public void setHost​(java.lang.String host)
                     throws java.lang.Exception
        Sets the host portion of the link's URL (the '[hostname]:[port]' portion).
        Parameters:
        host - the new host portion of the link's URL
        Throws:
        java.lang.Exception - if an error occurs
        See Also:
        MSDN Documentation
      • getHostname

        public java.lang.String getHostname()
        Returns the hostname portion of the link's URL.
        Returns:
        the hostname portion of the link's URL
        See Also:
        MSDN Documentation
      • setHostname

        public void setHostname​(java.lang.String hostname)
                         throws java.lang.Exception
        Sets the hostname portion of the link's URL.
        Parameters:
        hostname - the new hostname portion of the link's URL
        Throws:
        java.lang.Exception - if an error occurs
        See Also:
        MSDN Documentation
      • getPathname

        public java.lang.String getPathname()
        Returns the pathname portion of the link's URL.
        Returns:
        the pathname portion of the link's URL
        See Also:
        MSDN Documentation
      • setPathname

        public void setPathname​(java.lang.String pathname)
                         throws java.lang.Exception
        Sets the pathname portion of the link's URL.
        Parameters:
        pathname - the new pathname portion of the link's URL
        Throws:
        java.lang.Exception - if an error occurs
        See Also:
        MSDN Documentation
      • getPort

        public java.lang.String getPort()
        Returns the port portion of the link's URL.
        Returns:
        the port portion of the link's URL
        See Also:
        MSDN Documentation
      • setPort

        public void setPort​(java.lang.String port)
                     throws java.lang.Exception
        Sets the port portion of the link's URL.
        Parameters:
        port - the new port portion of the link's URL
        Throws:
        java.lang.Exception - if an error occurs
        See Also:
        MSDN Documentation
      • getProtocol

        public java.lang.String getProtocol()
        Returns the protocol portion of the link's URL, including the trailing ':'.
        Returns:
        the protocol portion of the link's URL, including the trailing ':'
        See Also:
        MSDN Documentation
      • setProtocol

        public void setProtocol​(java.lang.String protocol)
                         throws java.lang.Exception
        Sets the protocol portion of the link's URL.
        Parameters:
        protocol - the new protocol portion of the link's URL
        Throws:
        java.lang.Exception - if an error occurs
        See Also:
        MSDN Documentation
      • getDefaultValue

        static java.lang.String getDefaultValue​(HtmlElement element)
      • getText

        public java.lang.String getText()
        Returns the text attribute.
        Returns:
        the text attribute
      • setText

        public void setText​(java.lang.String text)
        Sets the text attribute.
        Parameters:
        text - the text attribute
      • getCharset

        public java.lang.String getCharset()
        Returns the charset attribute.
        Returns:
        the charset attribute
      • setCharset

        public void setCharset​(java.lang.String charset)
        Sets the charset attribute.
        Parameters:
        charset - the charset attribute
      • getCoords

        public java.lang.String getCoords()
        Returns the coords attribute.
        Returns:
        the coords attribute
      • setCoords

        public void setCoords​(java.lang.String coords)
        Sets the coords attribute.
        Parameters:
        coords - coords attribute
      • getHreflang

        public java.lang.String getHreflang()
        Returns the hreflang attribute.
        Returns:
        the hreflang attribute
      • setHreflang

        public void setHreflang​(java.lang.String hreflang)
        Sets the hreflang attribute.
        Parameters:
        hreflang - hreflang attribute
      • getOrigin

        public java.lang.String getOrigin()
        Returns the origin attribute.
        Returns:
        the origin attribute
      • getUsername

        public java.lang.String getUsername()
        Returns the username attribute.
        Returns:
        the username attribute
      • setUsername

        public void setUsername​(java.lang.String username)
        Sets the username attribute.
        Parameters:
        username - username attribute
      • getPassword

        public java.lang.String getPassword()
        Returns the password attribute.
        Returns:
        the password attribute
      • setPassword

        public void setPassword​(java.lang.String password)
        Sets the password attribute.
        Parameters:
        password - password attribute
      • getDownload

        public java.lang.String getDownload()
        Returns the download attribute.
        Returns:
        the download attribute
      • setDownload

        public void setDownload​(java.lang.String download)
        Sets the download attribute.
        Parameters:
        download - download attribute
      • getPing

        public java.lang.String getPing()
        Returns the ping attribute.
        Returns:
        the ping attribute
      • setPing

        public void setPing​(java.lang.String ping)
        Sets the ping attribute.
        Parameters:
        ping - ping attribute
      • getShape

        public java.lang.String getShape()
        Returns the shape attribute.
        Returns:
        the shape attribute
      • setShape

        public void setShape​(java.lang.String shape)
        Sets the shape attribute.
        Parameters:
        shape - shape attribute
      • getType

        public java.lang.String getType()
        Returns the type attribute.
        Returns:
        the type attribute
      • setType

        public void setType​(java.lang.String type)
        Sets the type attribute.
        Parameters:
        type - type attribute
      • getRelList

        public DOMTokenList getRelList()
        Returns the relList attribute.
        Returns:
        the relList attribute
      • setRelList

        public void setRelList​(java.lang.Object rel)
        Sets the relList property.
        Parameters:
        rel - attribute value