URL https://www.baidu.com/search?id=001&title=特色产品&type=01
- window.location.href
https://www.baidu.com/search?id=001&title=特色产品&type=01
- window.location.protocol
https
- window.location.host
www.baidu.com
- window.location.port
空字符串 80端口与未设置端口都返回空字符串
- window.location.pathname
/search
- window.location.search
?id=001&title=特色产品&type=01
URL https://www.baidu.com/#/search?id=001&title=特色产品&type=01
- window.location.hash
#/search?id=001&title=特色产品&type=01
获取11位随机字符串(其余长度可以由11位剪切拼接)
Math.random().toString(36).substring(2);