Migration from wxHTML to wxWebView in wxWidgets

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
reza_karimi76
In need of some credit
In need of some credit
Posts: 1
Joined: Sat Jul 31, 2021 11:55 am

Migration from wxHTML to wxWebView in wxWidgets

Post by reza_karimi76 »

I am trying to replace wxHTML with wxWebView in wxWidgets. I have a problem when trying to get URL of a clicked hyperlink. Previously the code was like this:

Code: Select all

void mywxHtmlWindow::OnLinkClicked( const wxHtmlLinkInfo& link )
{
    ...
    link.GetHref();
    ...
}
and now I have:

Code: Select all

void OnLinkClicked( wxWebViewEvent& evt )
   {
     ...
     evt.GetURL();
     ...
   }
Previous result was somethink like "myURL" and the current result is something like "about:myURL" and I don't know why there is "about:" at the beginning. What should I do to get the same result as before?

Update 1:
I have set the page source in both cases like below:

mBrowser->SetPage( currentPage_, wxString() );
and all tags in the page source are something like this:

<a href="myURL">clickHere</a>
and I want to get myURL string when I click on the link.

Update 2:

myURL could be any arbitrary string like a hash (e.g. myURL="git-c2b617b1ec4bbaba2201020ec946b037f5935b77").

It's not a usual URL like "http://www.google.com".
Post Reply