//获取当前窗口的主机名 var host = window.location.host; //结果:localhost:8080
//获取当前窗口的端口 var port = window.location.port; //结果:8080
//获取当前窗口的路径 var pathname = window.location.pathname; //结果:/homePage/Index
//获取当前文档的Url var URL = document.URL; //结果:http://localhost:8080/homePage/Index?id=1&type=1
//获取参数 var search = window.location.search; //结果:?id=1&type=1