473,395 Members | 2,006 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Open link with a Windows relative part %windir%

HI,
I try to open a link using %windir% in path:

<LI><A HREF="%windir%/temp/MainSetupLog.log">F </A></LI>

The browser does not seem to find the file.
However,If I paste in the Address window:

file:///%windir%/temp/MainSetupLog.log

It does open it properly.

Where is my problem ?

Thanks

Dec 25 '06 #1
8 6125
Scripsit MoshiachNow:
I try to open a link using %windir% in path:
Why? That doesn't make sense in the World Wide Web. What are you trying to
achieve by doing so, as opposite to using
<LI><A HREF="%windir%/temp/MainSetupLog.log">F </A></LI>
Makes no sense even syntactically. The "%" sign is reserved in URLs and
should thus be escaped. Besides, that would be a relative URL, relative to
the current base URL, not an absolute path in some file system.
However,If I paste in the Address window:

file:///%windir%/temp/MainSetupLog.log

It does open it properly.
That's an illusion. A file: URL may work within a particular computer, but
by definition, it is system-dependent. On a web page, it would refer to
something on the _user's_ computer, something that might very accidentally
exist. Advanced browsers may however prevent access to it from a web page
that way, as a security measure.
Where is my problem ?
I don't know, but I'm sure you're trying to solve the wrong problem now.

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

Dec 25 '06 #2
MoshiachNow wrote:
HI,
I try to open a link using %windir% in path:

<LI><A HREF="%windir%/temp/MainSetupLog.log">F </A></LI>

The browser does not seem to find the file.
However,If I paste in the Address window:

file:///%windir%/temp/MainSetupLog.log

It does open it properly.

Where is my problem ?

Thanks
First of all, what you want to do -- access a local file -- would work
only for you when the Web page itself is a local HTML file. Browsers
should not access local files from Web pages delivered from a Web
server. A browser that violates this rule has a serious security
vulnerability and should not be used.

The notation %windir% is symbolic for some actual local Windows
directory. You can't code it as a URL, even for a local HTML file.
Instead, you need the actual directory name. For example, your %windir%
for SeaMonkey (the browser that I use) might be [C:\Program
Files\SeaMonkey] while mine is [C:\SeaMonkey] because I don't install in
[Program Files].

Finally, the URL in the form <file:///[some local path]/[some local
file] is not the same as the URL in the form <[some local path]/[some
local file]>. The former is indeed for a local file in a local
directory. The latter is some file in a directory relative to the Web
page containing the reference.

--

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

Concerned about someone (e.g., Pres. Bush) snooping
into your E-mail? Use PGP.
See my <http://www.rossde.com/PGP/>
Dec 25 '06 #3
David E. Ross wrote:
MoshiachNow wrote:
>HI,
I try to open a link using %windir% in path:

<LI><A HREF="%windir%/temp/MainSetupLog.log">F </A></LI>

The browser does not seem to find the file.
However,If I paste in the Address window:

file:///%windir%/temp/MainSetupLog.log

It does open it properly.

Where is my problem ?

Thanks

First of all, what you want to do -- access a local file -- would work
only for you when the Web page itself is a local HTML file. Browsers
should not access local files from Web pages delivered from a Web
server. A browser that violates this rule has a serious security
vulnerability and should not be used.

The notation %windir% is symbolic for some actual local Windows
directory. You can't code it as a URL, even for a local HTML file.
No, actually, he's right when he says it works when typed into the
address line in IE, as surprising as that is.
Instead, you need the actual directory name. For example, your %windir%
for SeaMonkey (the browser that I use) might be [C:\Program
Files\SeaMonkey] while mine is [C:\SeaMonkey] because I don't install in
[Program Files].

Finally, the URL in the form <file:///[some local path]/[some local
file] is not the same as the URL in the form <[some local path]/[some
local file]>. The former is indeed for a local file in a local
directory. The latter is some file in a directory relative to the Web
page containing the reference.
Correct, though if he does put the form that works in the Address field,
with the "file:///" protocol, as the HREF, it still doesn't work.
Dec 25 '06 #4
VK
MoshiachNow wrote:
HI,
I try to open a link using %windir% in path:

<LI><A HREF="%windir%/temp/MainSetupLog.log">F </A></LI>

The browser does not seem to find the file.
However,If I paste in the Address window:

file:///%windir%/temp/MainSetupLog.log

It does open it properly.

Where is my problem ?
Browser is not a local file manager, it doesn't work with path but with
URL. The URLs format is defined in the RFC 1738, see if curious a copy
at <http://www.faqs.org/rfcs/rfc1738.html>

"%windir%/temp/MainSetupLog.log" string doesn't fit neither to relative
nor absolute URL syntax so is broken (in the browser context).

"file:///%windir%/temp/MainSetupLog.log" defines protocol FILE so it
can be potentially interpreted as a valid URL, so the browser gives it
a try.

FILE protocol as defined at section 3.10 of RFC 1738 has the form:
file://<host>/<path>

where <hostcan be empty string - this is interpreted then as "the
machine from which the URL is being interpreted".

<pathis a hierarchical directory path of the form
<directory>/<directory>/.../<name>

Because you have three slashes file:/// it is interpreted as <host>
being empty string with the above indicated meaning and <pathpart
being forwarded to the local file system for further processing. There
%windir% being resolved into c:/windows or wherever your Windows
installation is and c:/windows/temp/MainSetupLog.log file successully
loaded - if exists.

Dec 25 '06 #5
Dan

MoshiachNow wrote:
I try to open a link using %windir% in path:
....
Where is my problem ?
Trying to use system-specific stuff in a World Wide Web context? What
value of "%windir%" would you expect to exist on a MacOS or Linux
system?

--
Dan

Dec 26 '06 #6
Dan wrote:
MoshiachNow wrote:
>I try to open a link using %windir% in path:
...
>Where is my problem ?

Trying to use system-specific stuff in a World Wide Web context?
He isn't--he said in the previous thread that he's just creating pages
to run on his own local machine without a server. And I told him that
for that reason his posts are off-topic here, and suggested other
newsgroups that would relate to his questions, so why he's still barking
up this tree I can't say.
What
value of "%windir%" would you expect to exist on a MacOS or Linux
system?
Dec 26 '06 #7

MoshiachNow wrote:
HI,
I try to open a link using %windir% in path:

<LI><A HREF="%windir%/temp/MainSetupLog.log">F </A></LI>

The browser does not seem to find the file.
However,If I paste in the Address window:

file:///%windir%/temp/MainSetupLog.log

It does open it properly.
You didn't specify a protocol, like http:// or file:// in your <aThe
default is http:// and that doesn't understand the expansion of
environment variables like %windir%, so of course it doesn't work.

Even using file:///%windir%/temp/MainSetupLog.log is flakey. It might
work with one browser on one machine today, but don't expect it to work
reliably elsewhere.

Dec 27 '06 #8
Dan

Andy Dingley wrote:
You didn't specify a protocol, like http:// or file:// in your <aThe
default is http:// and that doesn't understand the expansion of
environment variables like %windir%, so of course it doesn't work.
There isn't a "default" protocol in URIs. Protocol-less links are
considered to be relative rather than absolute URIs, and are handled
with the protocol in the base URI of the document containing the link.

--
Dan

Dec 28 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: venkatesh | last post by:
Hi Members, I have used the below mentioned code to open a html page in a new browser. The window size is 200 x 300. In that browser, I've given code to open another browser of the same size....
40
by: Brian Jorgenson | last post by:
On my web page, I have a few hyperlinks with target frame of _blank. The hyperlink brings up a second window, but everytime I click on thie hperlink, it keeps bringing up a new window and not...
10
by: David McCulloch | last post by:
The following code opens a new window, but the "resizeTo" doesn't resize it. Why not? (Don't ask why I simply did not open the window with the new size....my original problem was how to open a...
23
by: Markus | last post by:
Hi, i have this problem: Sometimes, i can't reproduce, if i click on an small image on the website, the popup _AND_ an other Tab in firefox open. Here are the linkcode: <div...
2
by: Martin Geisler | last post by:
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQBDNmLx6nfwy35F3TgRAtjIAJ9ryEjr0kaaEapRD0z1bHQYmKi+1wCdEOZC /wY2033SyIVl0za07v8RMkk= =6BZ+ -----END PGP SIGNATURE-----
4
by: Abhishek Srivastava | last post by:
Hello All, Many people ask this question. I have installed .Net framework I wrote a program but I can't find csc.exe. I have to tell them that it is inside windows directory. But I myself don't...
17
by: Jon B | last post by:
Hi All! I have a ASP.NET 2.0 site that works on the Windows 2000 Server. However, when I tried to view this site on my local Windows XP machine, I get "Server Unavailable". If I switch the...
3
by: androoo | last post by:
Hi I need my users to have a shortcut to windows\tasks from my vb.net app. But im not sure the simplest solution to lauch explorer and navigate to the directory... Anyone help ??? Many...
38
by: ted | last post by:
I have an old link that was widely distributed. I would now like to put a link on that old page that will go to a new page without displaying anything.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.