location对象
location
表示当前页面的Url
信息
location.href; // http://www.example.com:8080/path/index.html?a=1&b=2#TOP
location.protocol; // 'http'
location.host; // 'www.example.com'
location.port; // '8080'
location.pathname; // '/path/index.html'
location.search; // '?a=1&b=2'
location.hash; // 'TOP'
页面切换location.assign('/')
页面刷新location.reload()
location.assign('https://www.baidu.com');
夹具