user539061
user539061

Reputation: 1

How to execute Javascript from ActiveX in IE

I have a javascript for example

try { __flash__toXML(onYouTubePlayerReady("")) ; } catch (e) { "<undefined/>"; } .

In FireFox, Adobe plugin(Flash player plugin) executes above Java Script by calling NPN_Evaluate and NPN_Evaluate() returns result also.

I am not getting how in IE, adobe flash player(ActiveX) executes the above and same JAVA script. But I am seeing a result in SetReturnValue() of IShockwaveFlash like </undefined>, <string>3456</string>. It looks like Adobe ActiveX is not using IHTMLWindow2::execScript() to execute JS.

I would like to know how to execute the JS code from ActiveX.

I know how to call a JS function with the help of IHTMLWindow2::execScript(). But IHTMLWindow2::execScript() does not returns result. Also I know How to call a JS function with the help of IDispatch() interfaces.

I would like to know how Adobe ActiveX is executing the above code. I am also developing a similar ActiveX for IE and I would like to execute similar kind of JS(above one) from ActiveX.

Upvotes: 0

Views: 457

Answers (3)

SanyaRusinova
SanyaRusinova

Reputation: 1

Although I do agree SWFObject is the best method, you can pass the values through the 'src' and 'movie' params. EX:

'src', '/resources/flash/corporateWebsitButtons?variable=value&variable2=value'
'movie', '/resources/flash/corporateWebsitButtons?variable=value&variable2=value'

Upvotes: 0

wyx
wyx

Reputation: 59

ActiveX uses IE's IHTMLWindow2::execScript() to execute javascript, but IHTMLWindow2::execScript() do not return result. It uses IshockwaveFlash::SetRerernValue and IShockwaveFlash::CallFunction to return javascript result.

Upvotes: 1

taxilian
taxilian

Reputation: 14324

To the best of my knowledge, there is no way to do what you're asking to do; at least if there is it is fairly new and only works on newer versions of IE (I haven't looked hard recently). One option, however, is to wrap the script in a function call and save the result of that call to some global variable (on window) that you can then query to get the return value.

I don't know for sure, but I would guess that this is something along the lines of what flash is doing.

Upvotes: 0

Related Questions