一些页面信息都是通过解析url得来的,那url中各个字段的含义是什么呢?
url: http://example.org:8888/foo/bar?q=baz#bang
对应 JavaScript location 对象中的各个属性:
href: http://example.org:8888/foo/bar?q=baz#bang
protocol: http:
hostname: example.org
host: example.org:8888
port: 8888
pathname: /foo/bar
search: ?q=baz
hash: #bang