I have a Silverlight Out-of-Browser (OOB) application which has a WebBrowser control inside it. Displayed website in inner web browser comes from the different domain than the application xap file. How could I automatically fill form displayed in the inner browser? Preferably directly with Silverlight, or JavaScript.
I have tried to invoke external JavaScript code from silverlight application:
webBrowser.InvokeScript ("eval", "document.getElementById('formField1').value = 'value1';" +
"document.getElementById('formField2').value = 'value2';"+
"document.forms[0].submit();");
Apparently Silverlight limits this functionality due to the security reasons (Cross-site scripting I think).
Executes the specified script, which is defined in the currently loaded HTML.
Since my JS code is not loaded in the HTML that is currently displayed in the web browser control I can't use this approach.
Most obvious solution is to modify target website to contain my JS code. But I would like to hear some other options.