You are here: Re: Default dir for file urls. « HTML « IT news, forums, messages
Re: Default dir for file urls.

Posted by Mike.Duffy on 03/07/07 21:05

"David E. Ross" <nobody@nowhere.not> wrote in
news:yJOdnahqQeUhsHvYnZ2dnUVZ_qrinZ2d@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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация