src/main/java/org/jsoup/nodes/Node.java
/**
     * Get an absolute URL from a URL attribute that may be relative (i.e. an <code>&lt;a href></code> or
     * <code>&lt;img src></code>.
     * <p/>
     * If the attribute value is already absolute (i.e. it starts with a protocol, like
     * <code>http://</code> or <code>https://</code> etc), and it successfully parses as a URL, the attribute is
     * returned directly. Otherwise, it is treated as a URL relative to the element's {@link #baseUri}, and made
     * absolute using that.
     * <p/>
     * As an alternate, you can use the {@link #attr} method with the <code>abs:</code> prefix.
     *
     * @param attributeKey The attribute key
     * @return An absolute URL if one could be made, or an empty string (not null) if the attribute was missing or
     * could not be made successfully into a URL.
     * @see #attr
     * @see java.net.URL#URL(java.net.URL, String)
     */
Get an absolute URL from a URL attribute that may be relative , and it successfully parses as a URL, the attribute is
returned directly. Otherwise, it is treated as a URL relative to the element's  #baseUri, and made
absolute using that.

As an alternate, you can use the  #attr method with the abs: prefix.

@param attributeKey The attribute key
@return An absolute URL if one could be made, or an empty string (not null) if the attribute was missing or
could not be made successfully into a URL.
Get an absolute URL from a URL attribute that may be relative and it successfully parses as a URL the attribute is returned directly . Otherwise it is treated as a URL relative to the element ' s #baseUri and made absolute using that . As an alternate you can use the #attr method with the abs : prefix . @param attributeKey The attribute key @return An absolute URL if one could be made or an empty string ( not null ) if the attribute was missing or could not be made successfully into a URL .
public String absUrl(String attributeKey) {
        Validate.notEmpty(attributeKey);
        String relUrl = attr(attributeKey);
        if (!hasAttr(attributeKey)) {
            return ""; 
        } else {
            URL base;
            try {
                try {
                    base = new URL(baseUri);
                } catch (MalformedURLException e) {
                    URL abs = new URL(relUrl);
                    return abs.toExternalForm();
                }
                URL abs = new URL(base, relUrl);
                return abs.toExternalForm();
            } catch (MalformedURLException e) {
                return "";
            }
        }
    }
public String absUrl ( String attributeKey ) { Validate . notEmpty ( attributeKey ) ; String relUrl = attr ( attributeKey ) ; if ( ! hasAttr ( attributeKey ) ) { return "" ; } else { URL base ; try { try { base = new URL ( baseUri ) ; } catch ( MalformedURLException e ) { URL abs = new URL ( relUrl ) ; return abs . toExternalForm ( ) ; } URL abs = new URL ( base , relUrl ) ; return abs . toExternalForm ( ) ; } catch ( MalformedURLException e ) { return "" ; } } }
Get an absolute URL from a URL attribute that may be relative (i.e.
Get an absolute URL from a URL attribute that may be relative ( i . e .
// nothing to make absolute with // the base is unsuitable, but the attribute may be abs on its own, so try that