wxWebView setPage render HTML String not work

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
sunose
Earned a small fee
Earned a small fee
Posts: 16
Joined: Tue Jul 07, 2009 2:01 am

wxWebView setPage render HTML String not work

Post by sunose » Tue Aug 28, 2012 8:24 am

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.

Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Re: wxWebView setPage render HTML String not work

Post by Auria » Tue Aug 28, 2012 4:44 pm

Hi,

this is probably worth a bug report and/or mailing list post.
"Keyboard not detected. Press F1 to continue"
-- Windows

sunose
Earned a small fee
Earned a small fee
Posts: 16
Joined: Tue Jul 07, 2009 2:01 am

Re: wxWebView setPage render HTML String not work

Post by sunose » Wed Aug 29, 2012 3:45 am

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.
Attachments
memoryprotocol.JPG
memoryprotocol.JPG (9.17 KiB) Viewed 1371 times

User avatar
doublemax
Moderator
Moderator
Posts: 14770
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxWebView setPage render HTML String not work

Post by doublemax » Wed Aug 29, 2012 8:47 am

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).
Use the source, Luke!

sunose
Earned a small fee
Earned a small fee
Posts: 16
Joined: Tue Jul 07, 2009 2:01 am

Re: wxWebView setPage render HTML String not work

Post by sunose » Wed Aug 29, 2012 10:35 am

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().

Post Reply