常用的路徑獲取方式如下:
window.location.pathname:設定或獲取物件指定的「檔名」或路徑。
window.location.href:
設定或獲取整個 url 為字串。
window.location.port:設定或獲取與 url 關聯的埠號碼。
window.location.protocol:設定或獲取 url 的協議部分。
window.location.hash:設定或獲取 href 屬性中在井號「#」後面的分段。
window.location.host:設定或獲取 location 或 url 的 hostname 和 port 號碼。
window.location.search:設定或獲取 href 屬性中跟在問號及其後面的部分(包含問號)。
專案路徑:
href:
pathname:
port:
protocol:
hash:
host:
search:
結果如下圖所示:
Java獲取當前專案的路徑
專案中可能需要讀取專案路徑下的模板等,我們可能需要知道模板的絕對路徑。可以通過如下兩種方法獲取 public void testgetpath throws ioexception比如我的專案templates下有兩個模板,如下圖 twapi with birthday gender.ftl的絕對路...
Python 獲取當前專案根路徑 目錄
usr bin env python coding utf 8 time 2020 9 23 18 16 author 維斯 file jar project util.py version 1.0 function import osclass jarprojectutil staticmetho...
c 如何獲取專案的根目錄
編寫程式的時候,經常需要用的專案根目錄。自己總結如下 1 取得控制台應用程式的根目錄方法 方法1 environment.currentdirectory 取得或設定當前工作目錄的完整限定路徑 2 取得web應用程式的根目錄方法 3 取得winform應用程式的根目錄方法 1 environment...