wood burning stoves
The moose likes HTML, CSS and JavaScript and the fly likes Sharing Variable w/Javascript and VBScript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Sharing Variable w/Javascript and VBScript" Watch "Sharing Variable w/Javascript and VBScript" New topic

Sharing Variable w/Javascript and VBScript

Kevin Brennan

Joined: Oct 23, 2003
Posts: 27
I found a code snippet on the web that uses VBscript embeddedin a Javascript to check for the presence of a plugin. Conditioned on passing a check for IE on a Windows platform, the following function is called:

detectIE("PDF.PdfCtrl.5","Acrobat Reader").

Code for the function:

I added some extra statements for debugging. The short story here is that the value for "result" is always false -- in other words, even if the IsObject function is true (meaning that the ActiveCObect exists), the Javascript never gets it. You can see this by observing that "result2" is always false even though it is changed within the VBScript.

Would this ever work? Is there a way to get Javascript to recognize a variable modified by VBScript?

Thanks to all who take the time to read this post.
[ August 12, 2005: Message edited by: Kevin Brennan ]
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
No, you can't share variables between VBS and JS. What you could do is provide a hidden field that's part of a form, and write a value into it using VBS, which can then be read by JS.
I agree. Here's the link: http://aspose.com/file-tools
subject: Sharing Variable w/Javascript and VBScript
It's not a secret anymore!