1. 程式人生 > >利用location物件來解析網址引數

利用location物件來解析網址引數

###示例網址:http://www.abcd.com:5000/a/b?a=1&b=2#c=3&d=4

- location.href       `"http://www.abcd.com:5000/a/b?a=1&b=2#c=3&d=4"` - location.protocol       `"http:"` - location.hostname       `"www.abcd.com"` - location.host       `"www.abcd.com:5000"` - location.port       `"5000"` - location.pathname       `"/a/b"` - location.search       `"?a=1&b=2"` - location.hash       `"#c=3&d=4"`