1

I want to read and fetch the contents of a cookie generated by web browser from activex control. I dont want to read the cookie from javascript and pass it to activex control. I want read the cookie directly from activex control. If it is possible then suggest me the APIs for that and also same thing I have to achieve using NPAPI also (so please suggest APIs in here also). So looking forward for some positive answers.

1 Answers1

0

What you can do is

1) hook up Web Browser events, using for example this sample How to sink HTML document events for WebBrowser host

2) once you get a hold on the loaded IHTMLDocument2 document interface, just read the value of the cookie property:

CComPtr<IHTMLDocument2> pDoc // get document from event as shown in the sample.

// read the cookie
CComBSTR cookie;
hr = pDoc->get_cookie(&cookie);

More on this here: Handling HTML Element Events

Note: for NSAPI I suggest you write another question with other tags as this is a totally different world.

Simon Mourier
  • 132,049
  • 21
  • 248
  • 298