Solved

Open an application through browser code

Posted on 2003-11-17
13
221 Views
Last Modified: 2008-02-01
I want to be able to open applications from a web page running locally on a terminal.

It is just to open word, excel, and other basic programmes like the European driving licence.

The box will be locked down so that only those aplications can be run.

I used the code below but because of its obvious security risk had now been disallowed in internet explorer.  Is there any other way to launch them.

Would I have to use an active x control?

<html>
<script type="text/javascript">

function techlog(app) {
var shell = new ActiveXObject("WScript.shell");
shell.run(app + " ",10);

}

</script>

<head>


<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body topmargin="0" leftmargin="0">
<map name="FPMap0">
  <area href="http://www.google.co.uk/" shape="rect" coords="214, 311, 322, 364" target="_blank">
  <area href="http://www.yahoo.co.uk/" shape="rect" coords="214, 377, 325, 416" target="_blank">
  <area href="http://www.altavista.com" shape="rect" coords="214, 428, 326, 478" target="_blank">
  <area href="http://www.lycos.com" shape="rect" coords="211, 489, 292, 529" target="_blank">
  <area href="http://www.webcrawler.com" shape="rect" coords="209, 543, 328, 579" target="_blank">
  <area coords="415, 319, 486, 384" shape="rect" href="http://rylibweb.man.ac.uk/" target="_blank">
  <area href="http://www.metacrawler.com/index.html" shape="rect" coords="575, 293, 671, 330" target="_blank">
  <area href="http://www.dogpile.com" shape="rect" coords="677, 296, 757, 332" target="_blank">
  <area href="http://www.profusion.com" shape="rect" coords="587, 343, 663, 372" target="_blank">
  <area href="http://www.debriefing.com/" shape="rect" coords="672, 342, 755, 372" target="_blank">
  <area href="http://www.yell.co.uk" shape="rect" coords="582, 406, 753, 441" target="_blank">
  <area href="http://www.merriamwebster.com/" shape="rect" coords="578, 458, 764, 501" target="_blank">
  <area href="http://www.encyclopedia.com/" shape="rect" coords="603, 516, 712, 578" target="_blank">
  <area href="http://myumist.umist.ac.uk/" shape="rect" coords="79, 127, 236, 154" target="_blank">
  <area href="http://www.umist.ac.uk/" shape="rect" coords="260, 128, 365, 150" target="_blank">
  <area href="http://webmail.umist.ac.uk/" shape="rect" coords="405, 129, 554, 150" target="_blank">
  <area href="http://rylibweb.man.ac.uk/" shape="rect" coords="572, 128, 701, 146" target="_blank">
  <area href="http://www.google.co.uk/" shape="rect" coords="756, 127, 880, 147" target="_blank">
  <area coords="393, 473, 510, 481" shape="rect" onClick="techlog('MSACCESS.EXE')">
  <area onClick="techlog('EXCEL.EXE')" shape="rect" coords="393, 497, 503, 508">
  <area onClick="techlog('POWERPNT.EXE')" shape="rect" coords="399, 518, 523, 532">
  <area onClick=" techlog (‘WORD.EXE’)" shape="rect" coords="400, 546, 495, 553">
  <area onClick="techlog('e:\ECDL.exe')" shape="rect" coords="357, 391, 560, 456">
  <area href="instructions.htm" shape="rect" coords="386, 566, 526, 592" target="_blank">
</map>
<img border="0" src="background.jpg" usemap="#FPMap0" width="1024" height="768" align="center">
</body>

</html>
0
Comment
Question by:ShamilShah
  • 6
  • 4
  • 2
13 Comments
 
LVL 16

Expert Comment

by:jaysolomon
Comment Utility
If the clients machine that is trying to open the document has excel,word,powerpoint,etc installed on their box, then when they click a normal link it will download it to the IE browser and open it up.

<a href="/test.xls" >Excel</a>
<a href="/test.doc" >Word</a>

0
 
LVL 1

Author Comment

by:ShamilShah
Comment Utility
No, I just want it to launch MS word, for them to use.  Not to open a specific document.  I could have template documents with I point to and this in turn will open word but that will not work for a programme like the European driving licence.
0
 
LVL 16

Accepted Solution

by:
jaysolomon earned 50 total points
Comment Utility
This works for me,
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
<!--
function ee(app){
var shell = new ActiveXObject("WScript.shell");
      shell.Run (app +".exe");
}
// -->
</script>
</head>
<body>
<a href="#" onclick="ee('excel');return false;">Excel</a>
</body>
</html>

you will get the security alert, and then if client allows it then excel will open
0
 
LVL 1

Author Comment

by:ShamilShah
Comment Utility
That used to work without a problem, until I ran one of the microsoft windows updates not I get an error: 'Automation server can't create object'.  This happens on even a low security setting within IE.

I assume this is because if you can run any shell command you could potentially run something like 'format c:'.

Jaysolomon is your computer up-to-date, does it have all of the windows updates installed?  

If it does any idea why mine comes up with that error?
0
 
LVL 16

Expert Comment

by:jaysolomon
Comment Utility
I have win2k all service packs and up-to-date patches.

I am thinking you have a bad patch or something, because i tested the code i posted and it worked like a charm.

Go to the MS update site and try updating your box again. Of course uninstall the last patch or two
0
 
LVL 1

Author Comment

by:ShamilShah
Comment Utility
I have tried it on more then one machine, we are running Win XP, might be an issue with that.  Not sure why, I will try and fiddle with the security settings and post again.

If anyone else had the same issue plese let me know.

Thanks
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 16

Expert Comment

by:jaysolomon
Comment Utility
i do not have XP so i cannot test on that platform, but i can tell ya win 2k works
0
 
LVL 2

Expert Comment

by:Codescripter
Comment Utility
Here at Spokane County, my department has run into numerous issues with XP/Internet Explorer and Microsoft patches.  I think Microsoft is simply releasing some buggy patches.
0
 
LVL 16

Expert Comment

by:jaysolomon
Comment Utility
Alone with some simply buggy software

just wait til longhorn arrives in late '04 or early '05
0
 
LVL 2

Expert Comment

by:Codescripter
Comment Utility
However, running Windows XP with IE and the latest updates, I ran jaysolomon's code and, after being warned about ActiveX controls being unsafe, Excel opened successfully.

0
 
LVL 1

Author Comment

by:ShamilShah
Comment Utility
Ok, I tried it on my computer at home and it worked fine.  As you can see my original script is identical and it worked fine, and then suddenly just stopped.

This leaves me a little bit of a problem.  I have 10 machines this code does not work on.  It worked fine and then just stopped working.

Some are locked down and two I have tried running as an administrator, with various (high-low) security settings.  They all give me the same error.

Has anyone else had the same problem?

The only other thing I can think of is that all this machines were updated through a cache, the updates could have got corrupted in cache, and then used by all of the machines to update.  Does this sound reasonable?

I will try reinstalling a machine tomorrow and bypass our cache and see what happens.  If anyone else has any ideas please let me know.

Thanks
0
 
LVL 16

Expert Comment

by:jaysolomon
Comment Utility
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: jaysolomon {http:#9764375}

Please leave any comments here within the next four days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jAy
EE Cleanup Volunteer
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

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 …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

744 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

15 Experts available now in Live!

Get 1:1 Help Now