2016-07-26 5 views
0

javascriptを使用して作業ディレクトリの実際のパスを検索しようとしています。私はこのポストから How to get the absolute path of the current javascript file namejavascriptを使用して実際のウィンドウパスを取得する方法

<script> 
    alert(location.pathname); // /tmp/test.html 
    alert(location.hostname); // localhost 
    alert(location.search); // ?blah=2 
    alert(document.URL);  // http://localhost/tmp/test.html?blah=2#foobar 
    alert(location.href);  // http://localhost/tmp/test.html?blah=2#foobar 
    alert(location.protocol); // http: 
    alert(location.host);  // localhost 
    alert(location.origin); // http://localhost 
    alert(location.hash);  // #foobar 
</script> 

しかし、私は例えばパス「:/ XAMPP/htdocsに/ myCurrentDirectory C」を見つけたいので、私が探してきたことを、それらのどれを読んで。どのようにこれを行うには...?

ありがとうございます。:)

答えて

3

できません。

URLとファイルパスの間の接続は、HTTPサーバーによってすべて内部的に処理されます(存在しない場合もあります)。その関係についてはクライアントに公開されていないので、クライアント側のコードはそれについて何も知ることができません。

+0

Oooowh .... Okiee ..ありがとうございました。 –

関連する問題