can-parse-uri
parseURI(url)
Parse a URI into its components.
import {parseURI} from "can"
parseURI("http://foo:8080/bar.html?query#change")
//-> {
// authority: "//foo:8080",
// hash: "#change",
// host: "foo:8080",
// hostname: "foo",
// href: "http://foo:8080/bar.html?query#change",
// pathname: "/bar.html",
// port: "8080",
// protocol: "http:",
// search: "?query"
// }
Parameters
- url
{String}
:The URL you want to parse.
Returns
{Object}
:
Returns an object with properties for each part of the URL. null
is returned if the url can not be parsed.