Search code examples
c++pluginsbrowsernetwork-programmingnpapi

How to get postdata attached to http request using npapi plugin


Is it possible to get postdata of post request using npapi plugin. We can easily access the url, cookies etc. using plugin, but what about post data!

FB::DOM::WindowPtr window = m_host->getDOMWindow();
referrer="";
title ="";postdata ="";
cookie = "";userAgent = "";

if (!window)
    return;

if (window->getJSObject()->HasProperty("document"))
     cookie = window->getNode("document")->getProperty<std::string>("cookie");
if (window->getJSObject()->HasProperty("document"))
     referrer = window->getNode("document")->getProperty<std::string>("referrer");
if (window->getJSObject()->HasProperty("document"))
     title = window->getNode("document")->getProperty<std::string>("title");
if (window->getJSObject()->HasProperty("navigator")) 
     userAgent = window->getNode("navigator")->getProperty<std::string>("userAgent");

Solution

  • Can you get it with Javascript? I don't think so; but if it were possible, that would be how you'd do it from NPAPI. NPAPI has no way to get the post data for a post request in a page, so the only stuff like that you can get is through javascript.