
У меня есть собственный класс обработчика файловой системы, производный от wxWebViewHandler, как показано ниже, и в функции GetFile я устанавливаю содержимое страницы. Все работает нормально, за исключением случаев, когда на странице нет контента. Возможно, мне стоит вернуть что-то еще.
Код: Выделить всё
struct WxHtmlFSHandler: public wxWebViewHandler
{
WxHtml* dst_;
WxHtmlFSHandler( const wxString& scheme, WxHtml* dst ): wxWebViewHandler( scheme ), dst_( dst )
{ }
wxFSFile* GetFile( const wxString& uri ) override;
~WxHtmlFSHandler()
{
dst_ = nullptr;
}
};
...
if( dst_ && !uri.empty() )
{
if( uri.Contains( dst_->defaultURL_ ) )
{
// load the page's content
//if( !dst_->currentPage_.empty() )
return new wxFSFile( new wxMemoryInputStream( dst_->currentPage_.data(), dst_->currentPage_.size() ),
uri, wxT( "text/html" ), dst_->currentAnchor_
#if wxUSE_DATETIME
, wxDateTime::Now()
#endif
);
...
}
Код: Выделить всё
#if wxUSE_WEBVIEW_IE
wxWebViewIE::MSWSetEmulationLevel( wxWEBVIEWIE_EMU_IE11 );
#endif
Подробнее здесь: https://stackoverflow.com/questions/732 ... off-htm-is