WebHTMLViewer + Pass and retrieve js values

Hi to all,

Maybe it’s a basic question but is breaking my head.

I have a WebHTMLViewer displaying a google map route through a LoadPage method. The loaded page is a string who contain html+js.

I need to pass and retrieve some variables to js code. How I can do this? Now, to pass info to js, I concatenate values inside the string before call LoadPage but maybe there’s a better way to do this. I have no idea how to retrieve js var from WebHTMLViewer.

I hope you can understand my question,

When you use WebHTMLViewer, it’s basically a Div’d iFrame, so if you have a page loaded with say…

<script type="text/javascript" > var a=5; </script>

in it’s contents…

You will need to access the inner frame itself…

something like:

var check=document.getElementById("iframeid").contentDocument.a; alert(check)

where iframeid is WebHTMLViewer.ControlID, in the parent window.

If you are still stuck after attempting to implement this (note **I’m not infront of Xojo at the moment so the above may need a little tweaking), I’ll be glad to make a demo if needed.

You can more easily obtain the data by altering the parent hashtag as well.


I tried your suggestion but I got this error:

“Could not execute returned javascript: document.getElementById(…).contentDocument is undefined”

Any ideas? I’m lost.

Thanks in advance


Already solved. I forgot to write “_inner” after ControlID.

Thanks again,