Link to home
Start Free TrialLog in
Avatar of k_kishore
k_kishore

asked on

Open an Application in a different window!

Hello guys,
Following is the situation and any help is certainly appreciated. Thanks

I have an url to a file (might be a word doc, pdf, or xls file) on a webpage. Ok. By default, if you click on the link, the associated file would open in the same browser window, in other words, the excel or word doc or pdf file would open up in the same browser window. Here comes the tricky part.
If I want the associated file(link) to be opened in the actual application say if the url is a link to a word doc, I want the word doc to be opened in MS Word by itself (in a separate window, just like when you double click on a word file), and not within the same or different browser window. Can I do this? Using what, how....?
 
Here is the real problem. I had a link on a website to a MS Project file I had created. When I clicked on the link, it opened up the project file within my browser fine. But when my boss tried to open it, it just hosed up his machine. He does have MS Project installed on his pc, and his pc has the same config as mine. Interesting factor however is, if he has MS Project running in the background, and then clicks on this link, it opens up the Project file within the browser fine. It won't work if the MS-Project is not running. Any ideas????
Avatar of Victor_R
Victor_R

k_kishore,

how files are opened is totally dependent on individual users' settings on their machines. All you can do is force the file to open in a new browser window, but even so, what happens then is dependent on local settings. If it's only your boss's computer that needs to be changed, do this:

[Go into Windows Explorer | Tools | Folder Options | File Types. Find the .doc extension (Microsoft Word Document) then edit it or select advanced (depending on OS) and deselect 'browse in same window'.]

Let me know.
You can't really over-ride the end users settings, what ever they have set usually goes.  What you can do is over-ride the function of opening the file.

A way to do this may be to set a content-disposition header which should force the end user to download the file.

In ASP (sorry, I'm an ASP-boy), this would be done as follows

<%
'***Init resp. obj
Response.Expires = 0
Response.Buffer
Response.Clear
Response.CacheControl = "public"

'***Add content disp header
Response.AddHeader "content-disposition","attachment; filename=MyPdf.pdf"))

'***Spit out the right kind of stuff
Response.CharSet = "UTF-8"
Response.ContentType = "application/pdf"

Dim objFile
Dim objStream

Set objFile = Server.CreateObject("File.binaryRead")
objStream = objFile.binaryRead("d:\data\MyPdf.pdf")

'***Write to the response object
Response.BinaryWrite objStream

'***Tidy up
Set objFile = Nothing
Response.Flush
Response.End
%>

I hope thatthis is helpful.

Matt
When I say force, I mean 'ask'.  The good old @save or open' option box.

:o)

Matt
It sounds like this is only for his boss, not for an Internet application or even for a corporation of 500 computers. He should be able to fix this at the end user level.
Avatar of k_kishore

ASKER

Guys,

Following will clearly explain the situation I am facing right now. I need this to work in many computers. I can't go and hit every computer, so I decided to write a Java Script code. Please let me know your suggestion for the following to work. I have 2 codes. If any one of it could work it is fine. Please help me with this and  I will certainly appreciate that.

Code 1:

Objective: When an url to a MS Project 98 file is clicked on a website, it should open the .mpp file in MS Project 98 by
outside of the browser(just like if you double click on the file) and not within the browser. Should be done with a Java/VB Script and not by changing any File Type properties
or adding the browser flag to the registry.

OS: WIN NT 4.00.1381
IE: 5.500.3314.2101
MS Project 98

Following code gives an error "Automation server can't create object"
The same code works on Win 2000 and XP. Is there a fix for Win NT?

<html>
<title>Test</title>
<body>
<script Language="JavaScript">

function openNotepad() {
   
 var oShell = new ActiveXObject("Shell.Application");
 var commandtoRun = "C:\\Program Files\\Microsoft Office\\Office\\WINPROJ.EXE";
 var commandParms = "C:/Filename.mpp";

 oShell.ShellExecute(commandtoRun, commandParms, "", "open", "1")
}
</script>

<a href="javascript:openNotepad()">Test.doc</a>

</body>

</html>

 
**********************************************************************
Code 2

Objective: When an url to a MS Project 98 file is clicked on a website, it should open the .mpp file in MS Project 98
outside of the browser(just like if you double click on the file) and not within the browser. Should be done with a Java/VB Script and not by changing any File Type properties
or adding the browser flag to the registry.

OS: WIN NT 4.00.1381
IE: 5.500.3314.2101
MS Project 98

Following code opens MS Project 98 application outside of the browser but not the associated .mpp file
Following code works for Word(.doc), Excel(.xls), Powerpoint (.ppt), Access (.mdb).

<html>
<title>Test</title>
<BODY>
<script language="JavaScript">
  function startProj(strFile)
  {
    var myApp = new ActiveXObject("MSProject.Application");  

    //"Word.Application" Opens MS Word
   

   if (myApp != null)
    {
      myApp.Visible = true;
      myApp.XXX.Open(strFile);
      // myApp.Documents.Open(strFile) opens a .doc file, what is the MS Project equivalent of Documents.open to open a .mpp file
    }
  }
</script>

<a href="javascript:startProj('Filename.mpp')">Test.doc</a>

</body>
***********************************************************
The main problem here is having access rights on the clients machine to spawn a new application.  You'll find that most people will have this locked down by default as it means that anyone can run anything from a web page using this command.  This is clearly undesirable as they could quite happily run "format c: /s" if they really wanted too.

From my experience, I don't think you're going to achieve it this way, nor do I believe that there is anyway to override the users settings in this instance.

As far as I can see, the only choice is 'save or open'.  Believe me - I've spent a while looking in to this on other occasions with not joy.  It is a very frustrating problem.

This is the extent of help I can offer on this.  I would be interested to hear if you find a way to do what you wish to achieve.

Matt
ASKER CERTIFIED SOLUTION
Avatar of Psyclones
Psyclones

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You may want to add comments on this topic or accept an answer if the subject is now closed.

Thanks

Psyclones
Avatar of turn123
k_kishore,
No comment has been added lately (206 days), so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:

RECOMMENDATION: Award points to Psyclones http:#8715901

Please leave any comments here within 7 days.

-- Please DO NOT accept this comment as an answer ! --

Thanks,

turn123
EE Cleanup Volunteer