Solved

prevent word document opening internet explorer

Posted on 2002-06-11
13
293 Views
Last Modified: 2010-07-27
Hi,
Is it possible to prevent, via code, a word doc from opening in Internet Explorer. If so how? Thank you and have a great day programming,
diek
0
Comment
Question by:diek_nf
  • 5
  • 4
  • 4
13 Comments
 
LVL 11

Expert Comment

by:thunderchicken
ID: 7069790
<%
Response.ContentType = "application/msword"
Response.Redirect("yourdoc.doc")
%>
0
 

Author Comment

by:diek_nf
ID: 7069855
T,
I should have added that it has been a while since I played areound with ASP or HTM, or maybe it was obvious from my question. So, placing the code.

<%
Response.ContentType = "application/msword"
Response.Redirect("/downloads/DonaldDuck.doc")
%>

<p align="center"><a href="/downloads/DonaldDuck.doc" >Download User Manual</a></p>
d
0
 
LVL 11

Accepted Solution

by:
thunderchicken earned 65 total points
ID: 7069881
Try this then

yourpage.asp

<p align="center"><a href="/downloads/download.asp?doc=DonaldDuck.doc" >Download User Manual</a></p>


download.asp

<%
Response.ContentType = "application/msword"
Response.Redirect(request.querystring("doc"))
%>
0
 

Author Comment

by:diek_nf
ID: 7069903
T,
I apologize, I just talked to my boss and our web server is not asp compatible. Can I covert the above to htm via script.
d
0
 
LVL 11

Expert Comment

by:mouatts
ID: 7070082
Are you saying that you want the word document to open inside Word rather than Internet Explorer. If so the short answer is no because this is controlled by IEs settings. Obvisouly if it is just your machine then you can change your settings.

You do this by going into Windows Explorer | Tools | Folder Options | File Types. Find the .doc extension then edit it or select advanced (depending on os) and deslect 'browse in same window'.

But bear in mind this effects all word documents that you may access via IE.

HTH
Steve
0
 

Author Comment

by:diek_nf
ID: 7070339
Steve,
Thanks for helping.

We want the word doc to download/save to disk. We do not want it opening in IE or Word. Independent of how the user has his or her browser set up.

Thunderchicken,
I hope you are not annoyed, I need your help,

diek
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 11

Expert Comment

by:mouatts
ID: 7070512
Ok then this is possible but potentially a bit tricky.

Firstly you will need to specify the wrong content type for the word file. Now I have a feeling (although am willing to be corrected) that if you pass IE a content type that it doesn't understand but it recognises the extension then it will open it in Word (in this case) anyway.

So I suspect the best content type to use is application/octet-stream

From plain HTML you can't get this mime type output although if you have access to the server configuration you might be ble to do it.

You could zip up the word document as a self extracting zip file which would probably do the trick.

Can you use anything other than just HTML/Javascript on the server (a perl CGI for example)?

Steve

0
 
LVL 11

Expert Comment

by:thunderchicken
ID: 7070704
diek,

I believe there's a way to do it using just HTML.  Javascript wont help since it's ran on the client.  Mouatts is in the right ballpark, I just don't know off the top of my head how to do it directly in HTML.
0
 
LVL 11

Expert Comment

by:mouatts
ID: 7070802
Thats the point thunderchicken you can't do it in HTML because it isn't HTML that you are downloading its a word document.

There is no mechanism on a link or within a form that indictates what the mime-type of the requested resource should be, if there were it would run contrary to the entire philosophy of HTTP. It can only be done as part of the response which by definition occurs at the server.

Steve
0
 

Author Comment

by:diek_nf
ID: 7070852
T,
I did not specify htm in my question, so you answered the question. We are trying to get our coy to use a no-unix server so we can use asp pages. Am i incorrect in assuming that unix servers cannot use asp?
d
0
 
LVL 11

Expert Comment

by:mouatts
ID: 7070909
No you are not correct if the server runs something called chillisoft then it can run asp although not many of the com objects that you can add on.

By the way I think it was a big mistake to accept the answer because it is wrong.

A redirection may not have any other header preceding it so the content type message is either junked or the redirection will fail.

When the redirection actually executes it is like a fresh request and new content types etc will be output.

More importantly it did not solve your problem.

You had already said that asp was a non-starter so to then go back an accept this as an answer just wastes the time of anyone else who has responded.

Steve
0
 
LVL 11

Expert Comment

by:thunderchicken
ID: 7070911
You can actually, chilisoft.com has ASP for apache I believe.  You can check it out and people have used it with moderate success.
0
 

Author Comment

by:diek_nf
ID: 7070986
steve,
I don't like pissing people off, if I had specified in my question HTM only it would be wrong. We are in the ASP area, so presumebly if someone saw this posting in ASP. Do you have the patience to get it working in asp?
==============================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
     <title>Untitled</title>
</head>

<body>
<p align="center"><a href="download.asp?doc=HazcomManual.doc" >Download User Manual</a></p>


</body>
</html>

===============Download.asp====================
<%
Response.ContentType = "application/msword"
Response.Redirect(request.querystring("doc"))
%>
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now