Name

getPath — Return the path extracted from a URL

Usage

URL.getPath(url)

url : String

Description

Returns the path part extracted from url. This function supports both relative and absolute URLs.

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

Examples

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

returns string "/"

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

returns string "../logo.wbmp"

URL.getPath("test:")

returns string ""

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

returns invalid

URL.getPath(invalid)

returns invalid

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.