Location ¶ÔÏóÊÇ Window ¶ÔÏóµÄÒ»¸ö²¿·Ö£¬¿Éͨ¹ý window.location ÊôÐÔÀ´·ÃÎÊ¡£
¾ÙÀý˵Ï Location ¶ÔÏó µÄÊôÐÔÓë·½·¨
hash:ÉèÖûò·µ»Ø´Ó¾®ºÅ (#) ¿ªÊ¼µÄ URL£¨Ãª£©
ÍøÖ·:http://www.devdao.com/index.html#head
·µ»Ø:#head
<script type="text/javascript">
document.write(location.pathname);
</script>
host:ÉèÖûò·µ»ØÖ÷»úÃûºÍµ±Ç° URL µÄ¶Ë¿ÚºÅ
ÍøÖ·:http://www.devdao.com:3389/index.html
·µ»Ø:www.devdao.com:3389
hostname:ÉèÖûò·µ»Øµ±Ç° URL µÄÖ÷»úÃû
ÍøÖ·:http://www.devdao.com:3389/index.html
·µ»Ø:www.devdao.com
href:ÉèÖûò·µ»ØÍêÕûµÄ URL
ÍøÖ·:http://www.devdao.com:3389/index.html
·µ»Ø:http://www.devdao.com:3389/index.html
pathname:ÉèÖûò·µ»Øµ±Ç° URL µÄ·¾¶²¿·Ö
ÍøÖ·:http://www.devdao.com/index.html#head
·µ»Ø:/index.html
port:ÉèÖûò·µ»Øµ±Ç° URL µÄ¶Ë¿ÚºÅ
ÍøÖ·:http://www.devdao.com:3389/index.html
·µ»Ø:3389
protocol:ÉèÖûò·µ»Øµ±Ç° URL µÄÐÒé
ÍøÖ·:http://www.devdao.com:3389/index.html
·µ»Ø:http:
search:ÉèÖûò·µ»Ø´ÓÎʺŠ(?) ¿ªÊ¼µÄ URL£¨²éѯ²¿·Ö£©¡£
ÍøÖ·:http://www.devdao.com/index.html?id=333
·µ»Ø:?id=333
assign():¼ÓÔØеÄÎĵµ
Óï·¨:window.location.assign(URL)
reload():ÖØмÓÔص±Ç°Îĵµ
Óï·¨:window.location.reload()
replace():ÓÃеÄÎĵµÌæ»»µ±Ç°Îĵµ
Óï·¨:window.location.replace()
¡¡