Robert Apostolico
Guest
|
I properly have my C# plugin able to call methods in my javascript code that was injected.
ie. HTMLDocument.parentWindow.execScript("launchInjectedJavascriptCode();");
I was curious though, if its possible to pass parameters into those methods, and if so, how.
If its possible, I'm guessing that it would be a one-way pass by literal.
Let's say my javascript injected method looked like this, with an parameter:
function launchInjectedJavascriptCode(xsParameter) {
try {
if ( xsParameter !== null ) {
// ...
}
}
catch (e) {
// ...
}
}
This may sound stupid, but in my C# plugin code, how do I properly pass that parameter?
Would it be similar to this:
// C# snippet ...
// this could be a very long, nasty value, perhaps even an html fragment.
var myParameter = "Hello Javascript";
HTMLDocument.parentWindow.execScript("launchInjectedJavascriptCode("" + myParameter + "");");
Hopefully I typed my " quotes and \ in the correct spot to essentially word-wrap the value of my parameter with double-quotes within the ( "parens" ).
Would that get passed into the javascript function?
Is there a limitation on the LENGTH of what is concatenated together and passed into execScript?
Thank you! |
|
Andrei Smolin
Add-in Express team
Posts: 18719
Joined: 2006-05-11
|
Robert,
In the manual - see the PDF file in the folder {Add-in Express}\Docs on your development PC - please search for this string "Module-script two-way interaction". This code sample describes how to call a script and assign a variable that the script uses.
Andrei Smolin
Add-in Express Team Leader |
|