文件网址的默认目录。 [英] Default dir for file urls.

查看:64
本文介绍了文件网址的默认目录。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

客户端文件系统中用于

文件网址的默认目录是什么?


通过执行一些实验,很明显来自另一个文件URL的不合格的

引用始终指向源目录。


即,来自url" file:// c:/ abc /def.htm" ;,如果你像

< href =" ghi.htm">或者< img src =" jkl.gif">那样引用,浏览器将寻找

" file:// c:/abc/ghi.htm"或file:// c:/abc/jkl.gif"。


但是在urlhttp://mno.htm"中,(即你放入的文件)在网络服务器上)

如果你使用< href =" file://ghi.htm">,或者< img src =" file://jkl.gif"> ;,确切地说

浏览器在哪里查找文件?我意识到它可能会依赖于操作系统,但主要是对Windows环境感兴趣。它是否使用其中一个用户或系统环境变量?
?或者它总是会失败吗?我无法猜出把文件放在哪里以便

找到他们喜欢这个。在我采用

系统方法将水印文件放入每个子目录

的文件系统并查看出现的内容之前,有没有人有任何建议?我想我实际上可以用这些免费软件html索引

构建器程序中的一小部分努力来实现这个目标,但它可能需要一段时间才能运行。 (然后清理

!!)

解决方案

Scripsit Mike.Duffy:


客户端文件系统中的默认目录是什么用于文件URL的



无论浏览器程序员决定什么。详细的语法,特别是文件网址的含义取决于系统,使得它们在WWW创作中几乎无用。你实际上并没有在网页上看到它们,除非

错误使用内部使用它们的创作软件的产品

(正确使用后用http网址替换它们) )。


从执行一些实验,很明显,来自另一个文件网址的不合格的

引用始终指向源

目录。



在您测试过的浏览器中可能会发生这种情况。你有数百万其他情况要测试几百元b / b。


我还没有

能够猜测放置文件的位置以便找到他们

喜欢这个。



只需停止猜测并将文件上传到网络服务器(或其他
http服务器),或 - 如果你是这样做是为了你自己使用或非常有限

用户范围 - 使用相对参考(任何地方都没有协议部分)

only


-

Jukka K. Korpela(Yucca)
http://www.cs.tut.fi/~jkorpela/


Mike.Duffy写道:


客户端文件系统中用于

文件URL的默认目录是什么?


通过执行一些实验,很明显来自另一个文件URL的不合格的

引用始终指向源目录。


即,在url" file:// c:/abc/def.htm"中,如果你像

< href =" ghi.htm"& gt;,或者< img src =" jkl.gif">,浏览器将查找

" file:// c:/abc/ghi.htm"或file:// c:/abc/jkl.gif"。


但是在urlhttp://mno.htm"中,(即你放入的文件)在网络服务器上)

如果你使用< href =" file://ghi.htm">,或者< img src =" file://jkl.gif"> ;,确切地说

浏览器在哪里查找文件?我意识到它可能会依赖于操作系统,但主要是对Windows环境感兴趣。它是否使用其中一个用户或系统环境变量?
?或者它总是会失败吗?我无法猜出把文件放在哪里以便

找到他们喜欢这个。在我采用

系统方法将水印文件放入每个子目录

的文件系统并查看出现的内容之前,有没有人有任何建议?我想我实际上可以用这些免费软件html索引

构建器程序中的一小部分努力来实现这个目标,但它可能需要一段时间才能运行。 (然后清理

!!)



通常,尝试通过
Web服务器上的网页将失败。大多数较新的浏览器会拒绝

尝试,因为允许此操作会产生安全漏洞。我认为

IE和各种Mozilla浏览器都会阻止这种尝试。


-

David E. Ross

< http://www.rossde.com/>


天然食物可能有害:看看所有的

死于自然原因的人。


" David E. Ross" < no **** @ nowhere.notwrote in

新闻:yJ *************************** ***@iswest.net:


Mike.Duffy写道:


>什么是客户端文件系统中的默认目录用于文件URL?


>

通常,尝试通过本地文件系统访问文件

Web服务器上的网页将失败。大多数较新的浏览器将拒绝

尝试



我通过试用和发现它确实有效的错误,(IE6SP1)和默认的

是C:\。语法非常具体。在服务器上,你可以把

完整路径,即在url中

http://index.htm


你可以使用


< a href ="文件:// C:/Sub_dir/Index.htm">点击这里!< / a>


,你可以只使用文件名,但不能按预期使用。

这个有效:


< a href =" file:/Index.htm">点击这里!< / a>

但你不能使用:


< a href =" file:Index.htm">点击这里!< / a>


也不是


< a href =" file://Index.htm">点击这里!< / a>


由于不明原因,失败需要很长时间(~30秒)。

一个有趣的旁注是你可以使用:


< a href =" file://server/share/Index.htm">点击此处!< / a>


访问共享资源。


< img ..tags wor k也很完美。请注意,字符串的

长度有一个限制。以上完整的路径有效,但不是完整的

我的文件路径。


我也尝试过放一个exe。 file作为参考,但它只显示目录中的所有文件而不是执行文件。
(Kudos

给MS,因为这里没有留下巨大的安全漏洞!)

另一个有趣的事情是如果你直接输入一个文件网址

地址栏,环境变量实际上已扩展!,即:


file://% SystemLoot%/Index.htm


将查找Index.htm在C:\ Windows \ System"中。但是,如果%..%

字符串在现有文件(即http文件)中,则它们将不会在客户端系统上展开./ br / >


What is the default directory in the client file system that is used for
file urls?

From performing a few experiments, it is clear that an unqualified
reference from another file url is always directed to the source directory.

I.e., from within url "file://c:/abc/def.htm", if you make a reference like
<href="ghi.htm">, or <img src="jkl.gif">,the browser will look for
"file://c:/abc/ghi.htm" or "file://c:/abc/jkl.gif".

But from within url "http://mno.htm", (i.e. a file you put on a web server)
if you use <href="file://ghi.htm">, or <img src="file://jkl.gif">, exactly
where does the browser look for the file? I realize that it would likely be
OS-dependant, but am chiefly interested in the Windows environment. Does it
use one of those user or system environment variables? Or will it always
fail? I have not been able to guess where to put the files in order to
"find" them like this. Does anyone have any suggestions before I take the
systematic approach of placing a watermarked file into every sub-directory
in my filesystem and seeing what comes up? I think I can actually do this
with a small amount of effort using one of those freeware html index
builder programs, but it would probably take a while to run. (And clean up
afterwards!!)

解决方案

Scripsit Mike.Duffy:

What is the default directory in the client file system that is used
for file urls?

Whatever the browser programmers decided. The detailed syntax and especially
the meaning of file urls is system-dependent, making them almost useless in
WWW authoring. You don''t actually see them much on web pages except as
products of wrong use of authoring software that uses them internally
(replacing them by http urls when used properly).

From performing a few experiments, it is clear that an unqualified
reference from another file url is always directed to the source
directory.

That might happen in the browsers you have tested. You have a few hundreds
of millions of other situations to test.

I have not
been able to guess where to put the files in order to "find" them
like this.

Just stop the guesswork and upload the files onto a web server (or other
http server), or - if you''re doing this for your own use or very restricted
user range only - use relative references (with no protocol part anywhere)
only.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/


Mike.Duffy wrote:

What is the default directory in the client file system that is used for
file urls?

From performing a few experiments, it is clear that an unqualified
reference from another file url is always directed to the source directory.

I.e., from within url "file://c:/abc/def.htm", if you make a reference like
<href="ghi.htm">, or <img src="jkl.gif">,the browser will look for
"file://c:/abc/ghi.htm" or "file://c:/abc/jkl.gif".

But from within url "http://mno.htm", (i.e. a file you put on a web server)
if you use <href="file://ghi.htm">, or <img src="file://jkl.gif">, exactly
where does the browser look for the file? I realize that it would likely be
OS-dependant, but am chiefly interested in the Windows environment. Does it
use one of those user or system environment variables? Or will it always
fail? I have not been able to guess where to put the files in order to
"find" them like this. Does anyone have any suggestions before I take the
systematic approach of placing a watermarked file into every sub-directory
in my filesystem and seeing what comes up? I think I can actually do this
with a small amount of effort using one of those freeware html index
builder programs, but it would probably take a while to run. (And clean up
afterwards!!)

In general, an attempt to access a file from a local file system via a
Web page on a Web server will fail. Most newer browsers will reject the
attempt because allowing this creates a security vulnerability. I think
both IE and the various Mozilla browsers will block the attempt.

--
David E. Ross
<http://www.rossde.com/>

Natural foods can be harmful: Look at all the
people who die of natural causes.


"David E. Ross" <no****@nowhere.notwrote in
news:yJ******************************@iswest.net:

Mike.Duffy wrote:

>What is the default directory in the client file system that is used
for file urls?

>
In general, an attempt to access a file from a local file system via a
Web page on a Web server will fail. Most newer browsers will reject
the attempt

I discovered by trial & error that it does work, (IE6SP1) and the default
is "C:\". The syntax is very specific. On the server, you can put the
full path, i.e. within url

http://index.htm

you can use

<a href="file://C:/Sub_dir/Index.htm">Click Here!</a>

as well, you can use just the file name, but not as expected.
This works:

<a href="file:/Index.htm">Click Here!</a>
but you cannot use:

<a href="file:Index.htm">Click Here!</a>

nor

<a href="file://Index.htm">Click Here!</a>

For unknow reasons, it takes a long time (~30 sec) to fail.
An interesting sidenote is that you can use:

<a href="file://server/share/Index.htm">Click Here!</a>

to access a shared resource.

<img ..tags work perfectly as well. Note that there is a limit on the
length of the string. The above "full" path works, but not the complete
"My Documents" path.

I also tried putting an "exe" file as a reference, but it just displays
all of the files in the directory instead of executing the file. (Kudos
to MS for not leaving a huge security hole here!)

Another interesting thing is that if you type a file url directly into
the address bar, environment variables are actually expanded!, i.e.:

file://%SystemRoot%/Index.htm

will look for "Index.htm" in C:\Windows\System". However, if the %..%
string is within an existing file (i.e. the http file), they will not be
expanded on the client system.


这篇关于文件网址的默认目录。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆