Solved

Open WORD doc in seperate window without the traditional toolbars.

Posted on 2003-11-19
11
899 Views
Last Modified: 2012-08-13
I want to open a word document in a new window without the standard MS WORD toolbars and menu's?
I want the client to just look at the document without giving him the possibility to use the MS WORD functions as SAVE, OPEN, etc.

Who can help me in this matter ???

Thanx.
0
Comment
Question by:benmarken
  • 8
  • 2
11 Comments
 
LVL 10

Expert Comment

by:Nushi
ID: 9778751
do you want to aloow him to change anything?
Nushi.
0
 
LVL 10

Accepted Solution

by:
Nushi earned 130 total points
ID: 9778775
Try this out

<html>

<head><title>load document</title>
<script language="JavaScript">
<!--//
function loadworddoc(){

      var doc = new ActiveXObject("Word.Application");
      var txt;
      doc.Visible=false;
      doc.Documents.Open(document.all.hello.value);
      txt = doc.Documents(document.all.hello.value).Content;
      document.all.myarea.value = txt;
      doc.quit(0);
}
function onBrowseClick() {
document.all['inp_File'].click();
}
</script>
</head>

<body>

<p><input type=button onClick="loadworddoc();" value="Load">

<p><input type=file name=hello>


<p>
<textarea name=myarea cols=50 rows=5>nothing here yet</textarea>
<br>


</body>

</html>

it will read the content of the document in to html text area.

Nushi.
0
 
LVL 11

Expert Comment

by:Zontar
ID: 9779303
There are several problems with your script, nushi:

1. ActiveX only works on MSIE/Windows.

2. You can't set the value for a file input.

3. A file input allows the browsing of the user's own local filesystem, not the filesystem on the server.

4. Furthermore it's not possible to keep someone from saving a file viewed over the Web -- if the user can view it, then a copy of it exists on the user's hard drive.

What you desire is simply not possible, Word toolbars or not. See #4 above.
0
 
LVL 10

Expert Comment

by:Nushi
ID: 9779499
1. Word is also windows only as far as i know.
2.
0
 
LVL 10

Expert Comment

by:Nushi
ID: 9779500
1. Word is also windows only as far as i know.
2.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 10

Expert Comment

by:Nushi
ID: 9779501
1. Word is also windows only as far as i know.
2.
0
 
LVL 10

Expert Comment

by:Nushi
ID: 9779535
sorry about it i was dissconected for some reason
and i cliked tab +ENTER.

Zontar some remarks regarding your comment

1. Word is also windows only as far as i know.
2. >>You can't set the value for a file input.
    Using active x you can do it.
 try the script pand see it in action

3. it can be on network as long as you have access to it (if you have network drive mapped).

4. here you are right.
    if its opened as word document it cant be prevented since its a plug-in/ActiveX
    thats has its own framework (toolbars  for example).

:-))
Nushi.

         
0
 
LVL 11

Expert Comment

by:Zontar
ID: 9779631
Office for Mac has been around for a long time. Word files can also be opened and viewed with OpenOffice and StarOffice on Linux, BSD, and Solaris.

ActiveX is not Web programming, it's Windows programming. It's also a horrid thing to use on the Web -- it's a security hole among other things. Besides, you're not using ActiveX to set the value of the file input, it is not possible to do this -- the user's action browses and sets the value (and yes, I do know what I'm talking about -- just because I don't like ActiveX does not mean I'm ignorant of its capabilities). When you click the "Browse" button, you're presented with a file-picker. The value is NOT pre-determined. Any value you place in the value attribute is ignored by the browser. Even Microsoft is not silly/irresponsible enough to allow programmers to override this in MSIE -- it would be a huge security risk.

And even MSDN says that document.all should not be used anymore, and that you should use W3C DOM methods like document.getElementById() instead.
0
 
LVL 10

Expert Comment

by:Nushi
ID: 9779662
>>Office for Mac has been around for a long time. Word files can also be opened and viewed with OpenOffice and StarOffice on Linux, BSD, and Solaris.

that new to me
>>document.all
i agree with you about that.
0
 

Author Comment

by:benmarken
ID: 9786681
Thanx guys but this is not the solution i was looking for.
I need a NEW window (_new) without the toolbars and menu's of msword.

The script should be used in a windows/msie environment so that should be ok.

Nushi script works ok but it does not show me the background and the headers and footer in the word document.
I guess that zontar is right that what i want is not possible.

thanx again
0
 
LVL 10

Expert Comment

by:Nushi
ID: 9786691
>> Nushi script works ok but it does not show me the background and the headers
thats beacuse my script reads the content and not the headers/footers

Nushi.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

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

21 Experts available now in Live!

Get 1:1 Help Now