Page 1 of 1

wxWebView setPage render HTML String not work

Posted: Tue Aug 28, 2012 8:24 am
by sunose
hi:
I am in Window xp sp3 and with mingw TDM gcc 4.5.2 and codeblock and wxWidgets 2.9.4
sample code like this:

Code: Select all

 wxWebView * html = wxWebView::New(bgpanel, wxID_ANY, "",wxPoint(5,5), wxSize(100,200));
     html->SetPage("<html><title>Title</title><body>Text</body></html>", "");
when run this and IE say: "Navigation to the webpage was canceled",
check the browser page properties url is:
res://ieframe.dll/navcancl.htm#http:///

the IE version is IE 8 and work correctly to browse the web site.

thanks in advance.

Re: wxWebView setPage render HTML String not work

Posted: Tue Aug 28, 2012 4:44 pm
by Auria
Hi,

this is probably worth a bug report and/or mailing list post.

Re: wxWebView setPage render HTML String not work

Posted: Wed Aug 29, 2012 3:45 am
by sunose
I try another way:
change code to this:

Code: Select all

 wxWebView * html = wxWebView::New(bgpanel, wxID_ANY, "",wxPoint(5,5), wxSize(100,200));
 wxFileSystem::AddHandler(new wxMemoryFSHandler());
        wxMemoryFSHandler::AddFile("data.html",
                                "<html><body><h1>Hello,World</h1></body></html>");
   html->LoadURL("memory:data.html");
but still not work.get error the protocol not support.

anyone tell me way to use wxWebView to work for programmatic html string?

thanks.

Re: wxWebView setPage render HTML String not work

Posted: Wed Aug 29, 2012 8:47 am
by doublemax
Take the webview sample, find the method WebFrame::OnUrl():

When i change this line:

Code: Select all

m_browser->LoadURL( m_url->GetValue() );
To this:

Code: Select all

m_browser->SetPage("<html><title>Title</title><body>TextXXX</body></html>", "");
It works for me (just type anything in the url control to trigger the method).

Re: wxWebView setPage render HTML String not work

Posted: Wed Aug 29, 2012 10:35 am
by sunose
doublemax wrote:Take the webview sample, find the method WebFrame::OnUrl():

When i change this line:

Code: Select all

m_browser->LoadURL( m_url->GetValue() );
To this:

Code: Select all

m_browser->SetPage("<html><title>Title</title><body>TextXXX</body></html>", "");
It works for me (just type anything in the url control to trigger the method).
for me ,the LoadURL is work properly.

but not work for HTML String SetPage().