WebHTMLViewer location in JavaScript

In a regular WebPage, I can get the window location with window.location.href;

How would I proceed to do the same to get the URL inside an HTMLViewer ?

I tried this :

ExecuteJavascript("alert($('#"+self.WebPage1.HTMLViewer1.ControlID+"').window.location.href)")

But I get this error :

[quote]Could not execute returned javascript: Cannot read property ‘location’ of undefined
Source: alert($(’#LUcLf9a6’).window.location.href)[/quote]

Try contentWindow instead of window.

FWIW, accessing the content of an IFRAME (which is what the htmlviewer is made from) may be susceptible to cross-site scripting restrictions, so keep that in mind as you proceed.

http://www.w3schools.com/jsref/prop_frame_contentwindow.asp

[quote=175700:@Greg O’Lone]Try contentWindow instead of window.

FWIW, accessing the content of an IFRAME (which is what the htmlviewer is made from) may be susceptible to cross-site scripting restrictions, so keep that in mind as you proceed.

http://www.w3schools.com/jsref/prop_frame_contentwindow.asp[/quote]

Thank you Greg.