如果用户访问http://地址,这段代码可以将用户自动转向https://地址
window.location = "https://" + window.location.hostname + window.location.pathname + window.location.search;
如果用户访问http://地址,这段代码可以将用户自动转向https://地址
window.location = "https://" + window.location.hostname + window.location.pathname + window.location.search;