I am hosting a web user control inside the xamWebHtmlViewer and need access to javascript methods that are in page that is run inside the xamWebHtmlViewer. Any ideas on how to access the page hosted within the HtmlViewer?
thanks in advance
Hello jmahoney,
The xamWebHtmlViewer doesn't have a public property referencing the loaded web page. It internally uses an IFRAME html element. So if you want to access the page's java script from your Silverlight application, you have to access the main page DOM. Then find the IFRAME element and access the page, and finally you'll have to get the javascript from the page.
It's a bit tricky but it's not impossible. Bear in mind that if you have more than one HtmlViewer it'll probably be difficult to distinguish the two IFRAMEs.
Regards,
Doychin Dochev
Hi Doychin,
Can you send a little more detail regarding this, I'm not sure which page DOM you are referring to. The page calling the silverlight control?
In my case I have default.html which calls my silverlight project. Within my project I'm loading an html page in the xamwebhtmlvewier, the html page loads a java applet. From a series of button click events in the silverlight page I want to pass variables to the java applet. Using HtmlPage.Window.Invoke I'm able to pass the variables to a javascript file that I use to send the values into the applet. But since I need the window to stay contained within a position in the page, HtmlPage.Window does not work for me.
I do have another HtmlViewer in my project.
Thanks,
Lisa