Reputation: 43
One can always invoke javascript like this:
mybrowser.Navigate("javascript:YourJavascriptFunction('yourArgument1', 'youArgument2')");
Mine is single Argument as comma separated string, say "110.1,2.2,24,55.5"
HTML has JS function quoted below.
How to ensure that logger gets array[1]=2.2 and array[2]=24. Removing single quotes '' around Argument, HTML behaves as if logger received nothing.
Whereas with single quotes '' around Argument included; it seems logger received "Argument" as text-string . This is verified by splitting the Argument in C# and then passing two separate Arguments.
function logger(msg){ var array = msg.split(','); V1g.refresh(array[1]); I1g.refresh(array[2]); }
Upvotes: 0
Views: 370
Reputation: 43
it might help other at some point in time:
geckoWebBrowser1.Navigate("javascript:logger('Argument0','Argument1','Argument2')");
needed to be replaced with :
geckoWebBrowser1.Navigate("javascript:logger('" + Argument0.ToString() + "','" + Argument1.ToString() + "','" + Argument2.ToString() + "')");
Upvotes: 1