对于一个URL,如https://localhost:9999/myapp/index.html
alert("protocol="+window.location.protocol);//"protocol=https
alert("location.host="+window.location.host);//location.host=localhost:9999
alert("location.hostname="+window.location.hostname);//location.hostname=localhost
alert("window.location.port="+window.location.port);//window.location.port=9999
alert("window.location.pathname="+window.location.pathname);// window.location.pathname=/myapp/index.html
var appURL = window.location.protocol + "//" + window.location.host+"/";//https://localhost:9999/
4810

被折叠的 条评论
为什么被折叠?



