Click to See Complete Forum and Search --> : WebBrowser Control


Bayu Ardianto
June 26th, 2007, 07:27 AM
I'm using .NET 2.0 webbrowser control. I'm updating the content on the fly using WebBrowser::Document::OpenNew() and WebBrowser::Document::Write() method.

In the documentation, it's stated that OpenNew() will reset the document. It used about:blank page as initial state. Then we can Write() on them.

But i got problem when i need to use navigation to bookmarks over the same page.

I wrote something like this:

myWebBrowser->Document->OpenNew();
...
...
...
myWebBrowser->Document->Write("<a href="#theTarget">Go There</a>");
...
...
...
myWebBrowser->Document->Write("<a name="theTarget">Go Here</a>");
...
...


It wrote successfuly. But when i tried to click "Go There" text, it didn't navigated to "Go Here" text beneath it.
I've enabled the "AllowNavigation" property. Still not working.

Help...

Krishnaa
June 26th, 2007, 07:41 AM
Try adding some distance between those 2 items, then you might be able to 'see' if it actually goes there.

Bayu Ardianto
June 26th, 2007, 11:23 AM
actually i have...

i've captured the Navigating event and popped up some message to see some action. When I clicked on the link, it didn't trigger any event.

FYI, it involves some javascript script that generate <a> (anchor element) for hyperlink target automatically. and I just tested to create hyperlink to one of them to see if it worked, and it didn't.

help... :(

Sahir
June 28th, 2007, 03:38 AM
It does not work as expected because there is no uri associated with the anchor. Rather than writing to the document why not write the html file to disk and load the file from there?