Calling VBScript from JavaScript

I

Ian Sedwell

Hi guys

Many thanks to all who replied to my original question. Actually, it's dead
easy and the way I was doing it was correct the first time. You do indeed
simply call the VBScript routine from the JavaScript routine. It doesn't
matter whether the scripts are in external files, or embedded in the HTML
document, so long as the VBScript is loaded before it is called from
JavaScript - obviously.

The VBScript routine can return a result to the calling JavaScript. If that
result needs to be stored, then it can go into a JavaScript global, a hidden
field in a frame, or a cookie depending on the operational requirement.

Where I was going wrong was allowing non-MSIE browsers to get to see the
VBScript at all. They always baulked at it. So all I did was introduce a
simple test to check what sort of browser I was dealing with and then load a
page that was pure JavaScript for non-MSIE browsers, or a different page
that was JavaScript plus VBScript for the MSIE crowd. Perhaps someone knows
of a way of hiding VBScript from non-MSIE browsers to allow a more elegant
solution.

Anyway... I have a working product and a happy client.

As a rider, some of you were concerned that PDFs should be being loaded into
a browser page for a variety of pretty good reasons, mostly concerned with
the time it takes to load, etc. To set your minds at ease, the project was
for a client to use over an intranet using a mix of MacOS and Windoze
platforms.

Have fun!

Ian
 
K

kaeli

Where I was going wrong was allowing non-MSIE browsers to get to see the
VBScript at all. They always baulked at it. So all I did was introduce a
simple test to check what sort of browser I was dealing with and then load a
page that was pure JavaScript for non-MSIE browsers, or a different page
that was JavaScript plus VBScript for the MSIE crowd. Perhaps someone knows
of a way of hiding VBScript from non-MSIE browsers to allow a more elegant
solution.

As I said in my other post. Conditionals for IE only. Much better than
"browser detection".
Modify this to call your VBScript.

<!--[if IE 5]>
<SCRIPT LANGUAGE="Javascript">
alert("Congratulations. You are running IE5 or later!");
</SCRIPT>
<P>Thank you for closing the message box.</P>
<![endif]-->

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top