Open an application through browser code

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>
LVL 1
ShamilShahAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

ShamilShahAuthor Commented:
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.
jaysolomonCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

ShamilShahAuthor Commented:
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?
jaysolomonCommented:
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
ShamilShahAuthor Commented:
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
jaysolomonCommented:
i do not have XP so i cannot test on that platform, but i can tell ya win 2k works
CodescripterCommented:
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.
jaysolomonCommented:
Alone with some simply buggy software

just wait til longhorn arrives in late '04 or early '05
CodescripterCommented:
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.

ShamilShahAuthor Commented:
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
jaysolomonCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.