GeeCON Prague 2014*
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
Author

Sharing Variable w/Javascript and VBScript

Kevin Brennan
Greenhorn

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
Marshal

Joined: Mar 22, 2005
Posts: 42061
    
  64
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.


Ping & DNS - my free Android networking tools app
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Sharing Variable w/Javascript and VBScript