 |
| Javascript General Javascript discussions. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

August 3rd, 2004, 06:55 AM
|
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
How to open .DOC in MS-Word file thru a link ?
I have an application that supports uploading and downloading of .DOC files designed in servlets.
Everything works fine.
My problem is the downloading part.
When I click a link, eg..<a href="/path/to/the/.doc/file">, the file opens succesfully...but in the browser and not MS-Word.
I want MS-Word application to open and then that file to be called in MS-Word.
I do not want to display the file in the browser.
Any suggessions using Javascript or JSP ?
Please Help.
Thanx alot
Regards,
Sherbir
__________________
Regards,
Sherbir
|
|

August 3rd, 2004, 08:20 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Hey,
I believe that you have to download it to your machine for that to work. Every doc I've seen loads in the browser, even if you specify target="_blank".
Brian
|
|

August 3rd, 2004, 08:23 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi Sherbir,
You can do it in IE, but your clients will need to set their browser settings to allow scripting of unsafe ActiveXObjects in your pages (this maybe ok for an intranet, but IMHO only the truly stupid would trust this in a public website)...
Code:
<script type="text/javascript">
var wordApp = new ActiveXObject("Word.Application");
wordApp.Visible = true;
wordApp.Documents.Open("[UrlOfWordDocument]");
</script>
HTH,
Chris
|
|

August 3rd, 2004, 11:50 PM
|
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
quote:Originally posted by ChrisScott
Hi Sherbir,
You can do it in IE, but your clients will need to set their browser settings to allow scripting of unsafe ActiveXObjects in your pages (this maybe ok for an intranet, but IMHO only the truly stupid would trust this in a public website)...
Code:
<script type="text/javascript">
var wordApp = new ActiveXObject("Word.Application");
wordApp.Visible = true;
wordApp.Documents.Open("[UrlOfWordDocument]");
</script>
HTH,
Chris
|
Hey Chris,
Thanx alot 4 ur advise. Actually I searched alot on the Internet also 4 this stuff and found that the idea u gave was quite useful.
I have implemented the same in my servlet but therez a problem...
I get an error saying that 'Automation server can't create object'...when I use the ActiveXObject thing.
Y's that so ? Any idea ?
How do u suggest I should remedy the situation ?
Regards,
Sherbir
|
|

August 4th, 2004, 03:17 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi Sherbir,
You need to allow scripting of unsafe ActiveX controls, otherwise IE will prevent you creating the word application object.
In IE tools -> Internet Options -> Security -> Custom Level, there is a setting "Initialize & script ActiveX controls not marked as safe", set this to prompt or enable.
But be sure you only allow this for sites you trust, otherwise somebody could seriously damage your machine.
Cheers,
Chris
|
|

January 26th, 2005, 02:46 PM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I appear to have the opposite problem.
I'd like to get a spreadsheet to open in the browser but it keeps opening up Excel
The code looks like this
<a href="Operator.xls" target="_blank">Operators</a>
I've tried javascript pop ups but that only seems to work for 'htm extension?
jake
|
|

January 27th, 2005, 06:30 AM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks Greg:D
|
|

January 27th, 2005, 10:42 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
If lowered security settings are not possible then you may be able to adapt this approach:
http://support.microsoft.com/default...;EN-US;q260519
Your users can then open or save the document but it shouldn't open in the browser.
--
Joe ( Microsoft MVP - XML)
|
|

February 16th, 2005, 04:16 AM
|
|
Registered User
|
|
Join Date: Feb 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
The fix is a mere 2 second job - go to a Folder then click on Tools | Folder Types | File Options and go down to DOC, click on Advanced and remove the checkbox from 'Browse in same window'. You're now fixed..
|
|
 |