473,394 Members | 1,840 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,394 software developers and data experts.

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 18378
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: sam | last post by:
I have to open a files for reading, which is currently being used by another process(say file X). I could open file X in notepad, without any issues. How can I open it in vb.net? I always get an...
0
by: Kin Ng | last post by:
I want to open the Web Log file E:\WINNT\system32\LogFiles\W3SVC1\ex030922.log so I can see the action of my web site in realtime. I can open the file using Notepad but I can get it opened using...
2
by: preetish | last post by:
Hi, I am a total novice to VC++..I have a dialog based application developed using MFC...my requirement is to open a file (with .dat or ..txt ext) invoking Notepad from my application. The user...
3
by: RN Das | last post by:
Hi expert, I have a small web application in C# and ASP.Net and I want to open a file in notepad when clicked on a linked button. Here is hander code when clicked on the link button. It can open...
13
by: ron1972 | last post by:
Hi I have a large pdf file that if I create an anchor link to, the browser will try to open the file, which takes quite a long time. Is there a way to force the browser to download the file rather...
2
by: Shilpa | last post by:
Hi All, I want to write C# code to identify a file type and open the file in the associated editor. For example, text files should be identified and opened in notepad, html should be opened in...
5
by: MrNobody | last post by:
I was writing a program that was reading data from files (not making any changes) and I used the File.OpenRead(filename) command. It threw an error for one file because it said the file was being...
6
by: =?Utf-8?B?TUNI?= | last post by:
I try to open a log file that is logging infomation by another process: StreamReader sr = File.OpenText(filePath); I got the exception message: The process cannot access the file...
0
by: onlyshanks28 | last post by:
Hi, I want to open a .doc file in web browser(firefox and IE). I have given a link but when I click on it,it gives 3 options Open,Save,,Cancel. I want either to remove the Save button or to...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.