?
Solved

prevent word document opening internet explorer

Posted on 2002-06-11
13
Medium Priority
?
300 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 260 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

801 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