ICE NoteBook
2009年9月17日 星期四
JavaScript - 取得目前網址以及其他資訊
這是我在網路上看到的,記錄一下,
原文章
假設現在我有個網頁,網址是:http://functionlab.org:80/tools/tcpproxy.php?user=FUNction#showscript
如果這網頁上有以下JavaScript 程式碼
<script type="text/javascript"> //http://www.w3schools.com/htmldom/dom_obj_location.asp document.write("location.href : "+location.href+"
"); document.write("location.protocol : "+location.protocol+"
"); document.write("location.hostname : "+location.hostname+"
"); document.write("location.host : "+location.host+"
"); document.write("location.port : "+location.port+"
"); document.write("location.pathname : "+location.pathname+"
"); document.write("location.search : "+location.search+"
"); document.write("location.hash : "+location.hash+"
"); </script>
那該網頁會顯示:
location.href : http://functionlab.org:80/tools/tcpproxy.php?user=FUNction#showscript location.protocol : http location.hostname : functionlab.org location.host : functionlab.org:80 location.port : 80 location.pathname : /tools/tcpproxy.php location.search : ?user=FUNction location.hash : #showscript
沒有留言:
張貼留言
‹
›
首頁
查看網路版
沒有留言:
張貼留言