I'm updating from 2924 and needed to move my event handler from the (now removed) render process' OnBeforeNavigation to the browser process ClientHandler::OnBeforeBrowse. This is mostly working, except that now I'm not getting any POST data, request->GetPostData returns null.
I tried modifying the stock CEFClient and I am not seeing any POST data there, for a simple search form that doesn't use AJAX or any modern HTML.
- Code: Select all
bool ClientHandler::OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
bool is_redirect) {
CEF_REQUIRE_UI_THREAD();
int count = 0;
CefRefPtr<CefPostData> post = request->GetPostData();
if (post.get())
{
CefPostData::ElementVector elements;
post->GetElements(elements);
count = elements.size();
if (count > 0)
{
MessageBoxA(NULL, "Test - POST data found", "POST OK", MB_OK);
}
}
else
{
std::string strURL = request->GetURL();
if (strURL.find("search.php") != std::string::npos)
MessageBoxA(NULL, "No POST data", "POST FAIL", MB_OK);
}
message_router_->OnBeforeBrowse(browser, frame);
return false;
}
This always displays the "No POST data" message box on form submit.
Am I attaching to the wrong OnBeforeBrowse event? Or do I need to do something like explicitly cast the request pointer to a more specific type than CefRequest?