469,626 Members | 1,800 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,626 developers. It's quick & easy.

How do I force a browser to open a certain file with notepad ?

HI,

How do I force a browser to open a certain file with notepad ?

<LI><A HREF="D:/Program Files/yohoLogFile.txt.4" ><p
style="font-family:font-size: 7pt;"yohoLogFile.txt.4 </A></LI>';

Thanks

Dec 10 '06 #1
5 17821
"MoshiachNow" <le**********@kodak.comwrites:
HI,

How do I force a browser to open a certain file with notepad ?
Fortunately you can't or the web would be even more unusable than it
is now!

You link to a resource. When the server sends it (as a reply to a
request for that resource) the server decides what type of data it is
and includes that information in the reply. The client software then
decides what to do with the resource. It can make that decision based
on any, all or none of the information it gets back, but most often it
will do so based on the type and some preferences set by the user.

If you have control of the server and client software (in an authoritarian
intranet for example) you may be able to instruct the server to serve
the files in question as a particular type (text/plain is the obvious
choice) and configure all the client software to use notepad to handle
such resources.

--
Ben.
Dec 10 '06 #2
MoshiachNow wrote:
HI,

How do I force a browser to open a certain file with notepad ?

<LI><A HREF="D:/Program Files/yohoLogFile.txt.4" ><p
style="font-family:font-size: 7pt;"yohoLogFile.txt.4 </A></LI>';
How do you know your user wants to open it in Notepad? That's up to the
user. And who says the user even *has* Notepad?
Dec 10 '06 #3
MoshiachNow wrote:
HI,

How do I force a browser to open a certain file with notepad ?

<LI><A HREF="D:/Program Files/yohoLogFile.txt.4" ><p
style="font-family:font-size: 7pt;"yohoLogFile.txt.4 </A></LI>';

Thanks
If the user is on a Mac, a UNIX box, or running Linux, you can't.
Notepad exists only in Windows.

I suggest that you give the file only the .txt extension (not .txt.4).
Then the server will send the file as ASCII text (MIME type text/plain).
The user's browser will then select whatever ASCII viewer the user
indicated for use.

--

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 10 '06 #4
VK

MoshiachNow wrote:
How do I force a browser to open a certain file with notepad ?

<LI><A HREF="D:/Program Files/yohoLogFile.txt.4" ><p
style="font-family:font-size: 7pt;"yohoLogFile.txt.4 </A></LI>';

Thanks
If you mean what you wrote (thus open a local file from a local HTML
page) the see
<http://groups.google.com/group/comp.lang.javascript/msg/9f1953d6e73c6821>

An updated version (supporting parameters) is at
<http://www.geocities.com/schools_ring/al.zip>

For the default security environment you basically can not. See other
answers.

Dec 10 '06 #5
Dan

MoshiachNow wrote:
How do I force a browser to open a certain file with notepad ?
http://webtips.dan.info/force.html
<LI><A HREF="D:/Program Files/yohoLogFile.txt.4" ><p
style="font-family:font-size: 7pt;"yohoLogFile.txt.4 </A></LI>';
Oh, neat... a "How Many Errors Can You Find In This Piece of Code"
brain teaser!

1) The HREF attribute value is not a valid URI. "D:" is not a
registered URI scheme. If you need to access a file in a local file
system (which would, of course, not be proper for the World Wide Web,
but might be for an intranet or kiosk of some sort) you should use a
"file:" URI.

2) <pis a block-level element, which is not proper to nest within
<a>, a character-level element.

3) The "font-family:" of the inline style is not actually followed by a
font family.

--
Dan

Dec 12 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Kin Ng | last post: by
13 posts views Thread by ron1972 | last post: by
2 posts views Thread by Shilpa | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.