Name

getHost — Return the host extracted from a URL

Usage

URL.getHost(url)

url : String

Description

Returns the host part extracted from url. This function supports both absolute and relative URLs. Returns the empty string if url doesn’t specify a host.

Returns invalid if url can’t be converted to a string or can’t be parsed as a URL.

Examples

URL.getHost("http://www.inhand.net/")

returns string "www.inhand.net"

URL.getHost("../logo.wbmp")

returns string ""

URL.getHost("http://www.inhand.net:xxx/")

returns invalid

URL.getHost(invalid)

returns invalid

Get Learning WML, and WMLScript now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.