例如下面的url:
http://baidu.com:8080/xxxx.html
location.ptotocol="http" 即:协议
location.hostname="baidu.com" 即:主机域名
location.port="8080" 即:端口号
例如下面的url:
http://baidu.com:8080/xxxx.html
location.ptotocol="http" 即:协议
location.hostname="baidu.com" 即:主机域名
location.port="8080" 即:端口号
转载于:https://www.cnblogs.com/waitinglulu/p/6688821.html